Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ public static partial class JNINativeWrapper
static bool _unhandled_exception (Exception e)
{
if (Debugger.IsAttached || !JNIEnvInit.PropagateExceptions) {
#if NETCOREAPP
AndroidRuntimeInternal.mono_unhandled_exception?.Invoke (e);
#else
JNIEnvInit.mono_unhandled_exception?.Invoke (e);
#endif
return false;
}
return true;
Expand Down Expand Up @@ -158,6 +162,17 @@ internal static void Wrap_JniMarshal_PPII_V (this _JniMarshal_PPII_V callback, I
}
}

internal static IntPtr Wrap_JniMarshal_PPII_L (this _JniMarshal_PPII_L callback, IntPtr jnienv, IntPtr klazz, int p0, int p1)
{
AndroidRuntimeInternal.WaitForBridgeProcessing ();
try {
return callback (jnienv, klazz, p0, p1);
} catch (Exception e) when (_unhandled_exception (e)) {
AndroidEnvironment.UnhandledException (e);
return default;
}
}

internal static void Wrap_JniMarshal_PPLI_V (this _JniMarshal_PPLI_V callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, int p1)
{
AndroidRuntimeInternal.WaitForBridgeProcessing ();
Expand Down Expand Up @@ -473,6 +488,8 @@ private static Delegate CreateBuiltInDelegate (Delegate dlg, Type delegateType)
return new _JniMarshal_PPJ_Z (Unsafe.As<_JniMarshal_PPJ_Z> (dlg).Wrap_JniMarshal_PPJ_Z);
case nameof (_JniMarshal_PPII_V):
return new _JniMarshal_PPII_V (Unsafe.As<_JniMarshal_PPII_V> (dlg).Wrap_JniMarshal_PPII_V);
case nameof (_JniMarshal_PPII_L):
return new _JniMarshal_PPII_L (Unsafe.As<_JniMarshal_PPII_L> (dlg).Wrap_JniMarshal_PPII_L);
case nameof (_JniMarshal_PPLI_V):
return new _JniMarshal_PPLI_V (Unsafe.As<_JniMarshal_PPLI_V> (dlg).Wrap_JniMarshal_PPLI_V);
case nameof (_JniMarshal_PPLZ_V):
Expand Down
8 changes: 7 additions & 1 deletion src/Mono.Android/Android.Runtime/JNINativeWrapper.g.tt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ var delegateTypes = new [] {
Return = "void",
Invoke = "jnienv, klazz, p0, p1",
},
new {
Type = "_JniMarshal_PPII_L",
Signature = "IntPtr jnienv, IntPtr klazz, int p0, int p1",
Return = "IntPtr",
Invoke = "jnienv, klazz, p0, p1",
},
new {
Type = "_JniMarshal_PPLI_V",
Signature = "IntPtr jnienv, IntPtr klazz, IntPtr p0, int p1",
Expand Down Expand Up @@ -271,7 +277,7 @@ foreach (var info in delegateTypes) {
<#= info.Return != "void" ? "return " : "" #>callback (<#= info.Invoke #>);
} catch (Exception e) when (_unhandled_exception (e)) {
AndroidEnvironment.UnhandledException (e);
<#= info.Return != "void" ? "return default;" : "" #>
<#= info.Return != "void" ? "\t\t\t\treturn default;" : "" #>
Comment on lines -274 to +280
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the output file had several lines of tabs:

}
}

Expand Down