You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=42366
A funny thing happened between Xamarin.Android 6.0 and 6.1: we bumped
from Mono 4.2 to Mono 4.4, and Mono 4.4 now uses Microsoft's
referencesource for `System.Exception`.
In Mono 4.2, `System.Exception.ToString()` accesses the
`System.Exception.StackTrace` property. Since
`Java.Lang.Throwable` overrode the `Exception.StackTrace` property to
append the Java-side stack trace, this was sufficient to cause
`.ToString()` usage to likewise contain the java-side stack:
var e = new Java.Lang.Throwable ("Boo!");
var s = e.ToString ();
// s contains "... --- End of managed exception stack trace --- ..."
This is *not* the case in Mono 4.4: `Exception.ToString()` *doesn't*
use the `Exception.StackTrace` property, so the `Throwable.StackTrace`
override is ignored, making for less-than-useful `.ToString()` value:
// s == "Java.Lang.Throwable: Exception of type 'Java.Lang.Throwable' was thrown"
// s does NOT contain the Java-side callstack!
Update `Java.Lang.Throwable` to override `Exception.ToString()` so
that the Java-side stack trace is always appended, if present. This
allows `Exception.ToString()` to be far more useful:
Java.Lang.Throwable: Exception of type 'Java.Lang.Throwable' was thrown.
--- End of managed Java.Lang.Throwable stack trace ---
java.lang.Throwable: Boo!
at md5bb7ab8908f0a1e03a3f881aa9f8f5eef.MainActivity.n_onCreate(Native Method)
at md5bb7ab8908f0a1e03a3f881aa9f8f5eef.MainActivity.onCreate(MainActivity.java:29)
...
0 commit comments