-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use mono_unhandled_exception
for NET6
#6104
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
938a341
to
d933d43
Compare
jonpryor
reviewed
Jul 20, 2021
d933d43
to
e012409
Compare
jonpryor
reviewed
Jul 21, 2021
254717f
to
ab2920f
Compare
Context: dotnet/runtime#55904 (comment) Context: dotnet#4927 (comment) Context: dotnet#4927 (comment) Xamarin.Android has been using the `AppDomain.DoUnhandledException` API since the dawn of time to propagate uncaught Java exceptions to the managed world. However, said API (and AppDomains) are gone from the NET6 MonoVM runtime and we need to switch to something else - the `mono_unhandled_exception` native API. This commit introduces an internal call, `JNIEnv.monodroid_unhandled_exception`, which is used instead of the older mechanism when targetting NET6 and which calls the native API mentioned above. Add a device integration test which makes sure the uncaught exceptions are propagated as required.
93beecf
to
0f67df4
Compare
mono_unhandled_exception
for NET6mono_unhandled_exception
for NET6
dellis1972
approved these changes
Jul 22, 2021
jonpryor
pushed a commit
that referenced
this pull request
Jul 22, 2021
Context: dotnet/runtime#55904 (comment) Context: #4927 (comment) Context: #4927 (comment) Context: xamarin/monodroid@7d62dec Context: dotnet/runtime@15ab9f9 Xamarin.Android has been using the `AppDomain.DoUnhandledException()` internal API since 2015 (xamarin/monodroid@7d62dec1) to propagate uncaught Java exceptions to the managed world. However, `AppDomain.DoUnhandledException()` was an internal API which was *removed* from MonoVM as part of the .NET 6 effort in dotnet/runtime@15ab9f98. For .NET 6, instead of calling the no-longer-present `AppDomain.DoUnhandledException()` method, call the [`mono_unhandled_exception()` embedding API][0], which in turn raises the `AppDomain.UnhandledException` event. Add a new internal call, `JNIEnv.monodroid_unhandled_exception()`, which is used on .NET 6 to invoke `mono_unhandled_exception()`. Add an on-device integration test which ensures that the uncaught exceptions are propagated as required. [0]: http://docs.go-mono.com/index.aspx?link=xhtml%3adeploy%2fmono-api-exc.html
thaystg
added a commit
to thaystg/xamarin-android
that referenced
this pull request
Jul 23, 2021
…er_unhandled_exception * origin/main: Bump to dotnet/installer@19943da 6.0.100-rc.1.21372.10 (dotnet#6110) [xaprepare] don't install microsoft-net-runtime-android workload (dotnet#6114) [Mono.Android] Use `mono_unhandled_exception` for NET6 (dotnet#6104) Bump to dotnet/installer@9c463710 6.0.100-rc.1.21369 (dotnet#6072) Bump to xamarin/xamarin-android-binutils/2.37-XA.1@77618674 v2.37 (dotnet#6096) [Mono.Android.Export] Fix DynamicDependency to JavaArray (dotnet#6105) [xaprepare] always delete ~/android-toolchain/dotnet (dotnet#6098) [CI] Add nuget to msi conversion and VS insert stage (dotnet#6030) [build] delete platform-31 folder on test jobs (dotnet#6103)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: dotnet/runtime#55904 (comment)
Context: #4927 (comment)
Context: #4927 (comment)
Xamarin.Android has been using the
AppDomain.DoUnhandledException
APIsince the dawn of time to propagate uncaught Java exceptions to the
managed world. However, said API (and AppDomains) are gone from the
NET6 MonoVM runtime and we need to switch to something else - the
mono_unhandled_exception
native API.This commit introduces an internal call,
JNIEnv.monodroid_unhandled_exception
, which is used instead of theolder mechanism when targetting NET6 and which calls the native API
mentioned above.
Add a device integration test which makes sure the uncaught exceptions
are propagated as required.