-
Notifications
You must be signed in to change notification settings - Fork 564
[Mono.Android] Java.Lang.Throwable overrides Exception.ToString() #107
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
Merged
Conversation
This file contains hidden or 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
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) ...
083d2cf to
27a71fc
Compare
Contributor
|
👍 |
radical
pushed a commit
that referenced
this pull request
May 8, 2018
…107) Fixes: dotnet/java-interop#106 Java 8 adds support for a `javac -parameters` option, which adds a `MethodParameters` attribute to the `.class` file. The `MethodParameters` attribute blob contains *reliable* parameter names, including for abstract methods and interface methods, unlike existing `LocalVariableTable`, which only exists for `javac -g` builds, and only for methods with *bodies*, i.e. *not* abstract methods and interface methods. Add support for parsing the `MethodParameters` attribute blob.
jonpryor
pushed a commit
that referenced
this pull request
May 26, 2022
Changes: dotnet/android-tools@fc3c2ac...20f6112 * dotnet/android-tools@20f6112: Bump LibZipSharp to 2.0.4 (#166) * dotnet/android-tools@e4f0d59: Add support for writing android:roundIcon to Android manifest (#162) Changes: dotnet/android-libzipsharp@2.0.3...2.0.4 * dotnet/android-libzipsharp@8ac30f3: Bump Version to 2.0.4 for Release (#109) * dotnet/android-libzipsharp@8e22fe1: Use RuntimeInformation to determine the Processor architecture. (#108) * dotnet/android-libzipsharp@33f5b01: Bump vcpkg to latest version (#106) * dotnet/android-libzipsharp@6fd0a14: [ci] Use new EO compliant build pools (#107) * dotnet/android-libzipsharp@d339358: Add a new more complex unit test (#105) Other changes: * 32-bit `libZipSharpNative.dll` is now in `x86\libZipSharpNative.dll`. * 64-bit `lib64\libZipSharpNative.dll` is now in `x64\libZipSharpNative.dll`.
simonrozsival
pushed a commit
to simonrozsival/xamarin-android
that referenced
this pull request
May 31, 2022
Changes: dotnet/android-tools@fc3c2ac...20f6112 * dotnet/android-tools@20f6112: Bump LibZipSharp to 2.0.4 (dotnet#166) * dotnet/android-tools@e4f0d59: Add support for writing android:roundIcon to Android manifest (dotnet#162) Changes: dotnet/android-libzipsharp@2.0.3...2.0.4 * dotnet/android-libzipsharp@8ac30f3: Bump Version to 2.0.4 for Release (dotnet#109) * dotnet/android-libzipsharp@8e22fe1: Use RuntimeInformation to determine the Processor architecture. (dotnet#108) * dotnet/android-libzipsharp@33f5b01: Bump vcpkg to latest version (dotnet#106) * dotnet/android-libzipsharp@6fd0a14: [ci] Use new EO compliant build pools (dotnet#107) * dotnet/android-libzipsharp@d339358: Add a new more complex unit test (dotnet#105) Other changes: * 32-bit `libZipSharpNative.dll` is now in `x86\libZipSharpNative.dll`. * 64-bit `lib64\libZipSharpNative.dll` is now in `x64\libZipSharpNative.dll`.
jonathanpeppers
referenced
this pull request
in jonathanpeppers/xamarin-android
May 31, 2022
Changes: dotnet/android-tools@fc3c2ac...20f6112 * dotnet/android-tools@20f6112: Bump LibZipSharp to 2.0.4 (dotnet#166) * dotnet/android-tools@e4f0d59: Add support for writing android:roundIcon to Android manifest (dotnet#162) Changes: dotnet/android-libzipsharp@2.0.3...2.0.4 * dotnet/android-libzipsharp@8ac30f3: Bump Version to 2.0.4 for Release (#109) * dotnet/android-libzipsharp@8e22fe1: Use RuntimeInformation to determine the Processor architecture. (#108) * dotnet/android-libzipsharp@33f5b01: Bump vcpkg to latest version (#106) * dotnet/android-libzipsharp@6fd0a14: [ci] Use new EO compliant build pools (#107) * dotnet/android-libzipsharp@d339358: Add a new more complex unit test (#105) Other changes: * 32-bit `libZipSharpNative.dll` is now in `x86\libZipSharpNative.dll`. * 64-bit `lib64\libZipSharpNative.dll` is now in `x64\libZipSharpNative.dll`.
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.
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 theSystem.Exception.StackTraceproperty. SinceJava.Lang.Throwableoverrode theException.StackTraceproperty toappend the Java-side stack trace, this was sufficient to cause
.ToString()usage to likewise contain the java-side stack:This is not the case in Mono 4.4:
Exception.ToString()doesn'tuse the
Exception.StackTraceproperty, so theThrowable.StackTraceoverride is ignored, making for less-than-useful
.ToString()value:Update
Java.Lang.Throwableto overrideException.ToString()sothat the Java-side stack trace is always appended, if present. This
allows
Exception.ToString()to be far more useful: