Commit e4debf7
authored
[One .NET] Use new API for exception debugger notification (#6106)
[One .NET] Use Mono embedding API for exception debugger notification (#6106)
Context: dotnet/runtime#56071
Context: #4877
Context: #4927 (comment)
Context: #4927 (comment)
Context: xamarin/monodroid@3e9de5a
Context: xamarin/monodroid@b0f8597
Context: xamarin/monodroid@12a012e
What should happen when an exception is thrown and a debugger is
attached?
This is in fact a loaded question: there's what Xamarin.Android
(Legacy) *has* done, vs. what .NET 6 Android for .NET does, vs.
what "should" happen.
What "should" happen is easiest:
1. We should behave like a "normal" Desktop .NET app when a debugger
is attached, AND
2. We shouldn't corrupt JVM state.
Unfortunately, (1)+(2) is currently not possible, in part because
Java doesn't have an equivalent to Windows' [two attempt][0] debugger
notification infrastructure.
See #4877 for details.
What Legacy Xamarin.Android does is also detailed in
#4877, and relies on the
`Debugger.Mono_UnhandledException()` method in order to alert an
attached debugger that there is an exception to show to the user.
However, `Debugger.Mono_UnhandledException()` never made it to the
`dotnet/runtime` repo. It never existed there.
Thus, what .NET 6 Android for .NET *currently* does is…*nothing*.
If an exception is thrown and a debugger is attached, the debugger
is *not* notified. Eventually you'll get an unhandled exception,
long after it was originally thrown; see commit c1a2ee7.
PR dotnet/runtime#56071 added a new
`mono_debugger_agent_unhandled_exception()` Mono embedding API which
is equivalent to `Debugger.Mono_UnhandledException()` for use with
.NET 6 + MonoVM.
Update `src/Mono.Android` and `src/monodroid` so that
`mono_debugger_agent_unhandled_exception()` is used to alert the
debugger that an exception has been thrown at a JNI boundary.
This should allow .NET 6 + Android to have equivalent exception
handling semantics as legacy Xamarin.Android.
[0]: https://docs.microsoft.com/en-us/windows/win32/debug/debugger-exception-handling1 parent 97e543a commit e4debf7
File tree
4 files changed
+26
-1
lines changed- src
- Mono.Android/Android.Runtime
- monodroid/jni
4 files changed
+26
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
245 | 250 | | |
246 | 251 | | |
247 | 252 | | |
| |||
695 | 700 | | |
696 | 701 | | |
697 | 702 | | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
698 | 708 | | |
699 | 709 | | |
700 | 710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
289 | 292 | | |
290 | 293 | | |
291 | 294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1004 | 1012 | | |
1005 | 1013 | | |
1006 | 1014 | | |
| |||
1011 | 1019 | | |
1012 | 1020 | | |
1013 | 1021 | | |
| 1022 | + | |
1014 | 1023 | | |
1015 | 1024 | | |
1016 | 1025 | | |
| |||
0 commit comments