Skip to content
Prev Previous commit
Next Next commit
Merge branch 'main' into wasm_optional_legacy_interop
# Conflicts:
#	src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/JavaScriptExports.cs
  • Loading branch information
pavelsavara committed Dec 26, 2022
commit 17960aea83007bb0a9f245b5a07ad893340ab970
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public static void CallEntrypoint(JSMarshalerArgument* arguments_buffer)
arg_1.ToManaged(out IntPtr entrypointPtr);
if (entrypointPtr == IntPtr.Zero)
{
throw new MissingMethodException(SR.Format(SR.MissingEntrypoint));
throw new MissingMethodException(SR.MissingManagedEntrypointHandle);
}

RuntimeMethodHandle methodHandle = JSHostImplementation.GetMethodHandleFromIntPtr(entrypointPtr);
// this would not work for generic types. But Main() could not be generic, so we are fine.
MethodInfo? method = MethodBase.GetMethodFromHandle(methodHandle) as MethodInfo;
if (method == null)
{
throw new InvalidProgramException(SR.Format(SR.EntrypointHandle));
throw new InvalidOperationException(SR.CannotResolveManagedEntrypointHandle);
}

arg_2.ToManaged(out string?[]? args);
Expand Down Expand Up @@ -75,7 +75,7 @@ public static void CallEntrypoint(JSMarshalerArgument* arguments_buffer)
}
else
{
throw new InvalidProgramException(SR.Format(SR.ReturnTypeNotSupportedForMain, method.ReturnType.FullName));
throw new InvalidOperationException(SR.Format(SR.ReturnTypeNotSupportedForMain, method.ReturnType.FullName));
}
arg_result.ToJS(result, (ref JSMarshalerArgument arg, int value) =>
{
Expand Down Expand Up @@ -154,7 +154,7 @@ public static void CallDelegate(JSMarshalerArgument* arguments_buffer)
}
else
{
throw new InvalidOperationException(SR.Format(SR.NullToManagedCallback));
throw new InvalidOperationException(SR.NullToManagedCallback);
}
}
catch (Exception ex)
Expand All @@ -181,7 +181,7 @@ public static void CompleteTask(JSMarshalerArgument* arguments_buffer)
}
else
{
throw new InvalidOperationException(SR.Format(SR.NullTaskCallback));
throw new InvalidOperationException(SR.NullTaskCallback);
}
}
catch (Exception ex)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.