Repository navigation
Description
Steps to Reproduce
- Create new XamarinForms project (template from VSforMac for example).
- Create class FooException : Exception.
- Hook into AppDomain.CurrentDomain.UnhandledException with a method Bar(sender, args) that receives the exception in the args.ExceptionObject property.
- Make the AppPage of the app throw this new FooException.
- Run the app in iOS: exception received is of type FooException.
- Run the app in Android.
Expected Behavior
Exception received by the Bar() method is of type FooException (or at least contains the FooException in the InnerException chain?)
Actual Behavior
Exception received by the Bar() method is of type JavaProxyThrowable, and its message is "Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown". The only bit of "FooException" found in this exception object is in the stack trace, however this is not an acceptable way for the callers to find what exception was really thrown, especially because it would need to be platform-specific code (only Android exhibits this behaviour, other platforms don't).
Version Information
Visual Studio Community 2017 for Mac
Version 7.3.2 (build 12)
Installation UUID: fd06ff65-69de-47ae-8b99-ddf257032b7c
Runtime:
Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 504010007
NuGet
Version: 4.3.1.4445
.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.0.0
SDK: /usr/local/share/dotnet/sdk/2.0.0/Sdks
SDK Version: 2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks
Xamarin.Profiler
Version: 1.6.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Xamarin.Android
Version: 8.1.0.25 (Visual Studio Community)
Android SDK: /Users/andres/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
7.1 (API level 25)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 26.0.2
SDK Build Tools Version: 26.0.3
Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Apple Developer Tools
Xcode 9.2 (13772)
Build 9C40b
Log File
(I don't believe there's need for a log file)
Activity
jonpryor commentedon Jan 2, 2018
The problem is that we don't "unwrap" exceptions when raising the
AppDomain.UnhandledExceptionevent:exwill be aJava.Lang.Throwableinstance, e.g.JavaProxyThrowable, which explains the described behavior.Unwrap JavaProxyThrowable in unhandled exception handler
[Mono.Android] Unwrap JavaProxyThrowable for unhandled exceptions (#1155
knocte commentedon Jan 5, 2018
Wow guys that was fast! Thank you, and happy new year.
By the way, am new to XamarinAndroid, so how will I be able to get this bugfix? Through nuget or through VS4Mac update? (And is there anyway to know the version number I should be looking for...?)
Thanks!
jonpryor commentedon Jan 5, 2018
@knocte asked:
That depends on whether you need a "proper" commercial installer, or if you can use just the OSS bits. The fix is only on master at present, and thus won't be released commercially until "d15-7"/Xamarin.Android 8.3. (Release date unknown.)
If you can you the OSS builds, you can follow the steps within
Documentation/UsingJenkinsBuildArtifacts.mdand grab one of the files from Jenkins, e.g.oss-xamarin.android_v8.2.99.7_Darwin-x86_64_HEAD_fceace9.zipXamarin.Android.Sdk-OSS-8.2.99.7_HEAD_fceace9.vsixBump to xamarin/monodroid@ad19471 (#5508)