Skip to content

Xamarin Android: System.NullReferenceException on any exception thrown inside Task #7102

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


If we try to throw any exception inside a Task and not catch it, the original exception is lost and NullReferenceException is raised instead. If we try to catch the exception, it works properly.
This behavior is not observed in VS2019, it works properly there with this same project.

Attached Screenshot provides all the necessary information.

Stack trace output:
at Android.Runtime.JNINativeWrapper._unhandled_exception (System.Exception e) [0x0000e] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V (_JniMarshal_PPL_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.IntPtr p0) [0x0001d] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:111
at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(intptr,intptr,intptr)


Original Comments

Feedback Bot on 6/14/2022, 01:32 AM:

(private comment, text removed)


Original Solutions

(no solutions)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions