Skip to content

Conversation

@jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Jul 6, 2016

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)
  ...

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)
	  ...
@jonpryor jonpryor force-pushed the jonp-throwable-tostring branch from 083d2cf to 27a71fc Compare July 6, 2016 20:27
@garuma
Copy link
Contributor

garuma commented Jul 6, 2016

👍

@dellis1972 dellis1972 merged commit 7a3c14a into dotnet:master Jul 6, 2016
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`.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants