Skip to content

[CoreCLR] Propagate unhandled Java exceptions #10657

Closed

Description

@simonrozsival

Android framework version

net10.0-android (Preview)

Affected platform version

.NET 10

Description

The JNIEnv.PropagateUncaughtException implementation for CoreCLR is missing:

internal static void PropagateUncaughtException (IntPtr env, IntPtr javaThreadPtr, IntPtr javaExceptionPtr)
{
if (!JNIEnvInit.PropagateExceptions)
return;
var javaException = JavaObject.GetObject<Java.Lang.Throwable> (env, javaExceptionPtr, JniHandleOwnership.DoNotTransfer)!;
if (Debugger.IsAttached) {
AndroidRuntimeInternal.mono_unhandled_exception?.Invoke (javaException);
}
try {
var jltp = javaException as JavaProxyThrowable;
Exception? innerException = jltp?.InnerException;
Logger.Log (LogLevel.Info, "MonoDroid", "UNHANDLED EXCEPTION:");
Logger.Log (LogLevel.Info, "MonoDroid", javaException.ToString ());
if (RuntimeFeature.IsMonoRuntime) {
MonoDroidUnhandledException (innerException ?? javaException);
} else if (RuntimeFeature.IsCoreClrRuntime) {
// TODO: what to do here?
} else {
throw new NotSupportedException ("Internal error: unknown runtime not supported");
}
} catch (Exception e) {
Logger.Log (LogLevel.Error, "monodroid", "Exception thrown while raising AppDomain.UnhandledException event: " + e.ToString ());
}
}

Steps to Reproduce

Did you find any workaround?

No response

Relevant log output

Activity

  1. added
    needs-triage
    Area: CoreCLR
    on Dec 29, 2025
  2. added this to the .NET 11 milestone on Dec 29, 2025
  3. removed
    needs-triage
    on Dec 29, 2025
  4. locked and limited conversation to collaborators on Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: CoreCLR

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions