diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj
index 7ef580cd5ea70..f67b0cd3b0346 100644
--- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj
+++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj
@@ -29,6 +29,7 @@
+
diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/JavaScriptExports.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/JavaScriptExports.cs
index 2fbf3f448f5cd..e98a845b758f2 100644
--- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/JavaScriptExports.cs
+++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/JavaScriptExports.cs
@@ -8,7 +8,7 @@
namespace System.Runtime.InteropServices.JavaScript
{
// this maps to src\mono\wasm\runtime\corebindings.ts
- // the methods are protected from trimming by DynamicDependency on JSFunctionBinding.BindJSFunction
+ // the public methods are protected from trimming by DynamicDependency on JSFunctionBinding.BindJSFunction
internal static unsafe partial class JavaScriptExports
{
[MethodImpl(MethodImplOptions.NoInlining)] // https://github.com/dotnet/runtime/issues/71425
diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/LegacyExports.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/LegacyExports.cs
index 757eddc9aef45..6aa4a5acf2e57 100644
--- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/LegacyExports.cs
+++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/LegacyExports.cs
@@ -10,7 +10,7 @@
namespace System.Runtime.InteropServices.JavaScript
{
// this maps to src\mono\wasm\runtime\legacy\corebindings.ts
- // the methods are protected from trimming by DynamicDependency on JSFunctionBinding.BindJSFunction
+ // the public methods are protected from trimming by DynamicDependency on JSFunctionBinding.BindJSFunction
internal static unsafe partial class LegacyExports
{
[MethodImplAttribute(MethodImplOptions.NoInlining)] // https://github.com/dotnet/runtime/issues/71425
@@ -56,7 +56,7 @@ public static IntPtr TryGetCSOwnedObjectJSHandleRef(in object rawObj, int should
}
[MethodImplAttribute(MethodImplOptions.NoInlining)] // https://github.com/dotnet/runtime/issues/71425
- public static void CreateCSOwnedProxyRef(nint jsHandle, JSHostImplementation.MappedType mappedType, int shouldAddInflight, out JSObject jsObject)
+ public static void CreateCSOwnedProxyRef(nint jsHandle, LegacyHostImplementation.MappedType mappedType, int shouldAddInflight, out JSObject jsObject)
{
JSObject? res = null;
@@ -69,12 +69,12 @@ public static void CreateCSOwnedProxyRef(nint jsHandle, JSHostImplementation.Map
#pragma warning disable CS0612 // Type or member is obsolete
res = mappedType switch
{
- JSHostImplementation.MappedType.JSObject => new JSObject(jsHandle),
- JSHostImplementation.MappedType.Array => new Array(jsHandle),
- JSHostImplementation.MappedType.ArrayBuffer => new ArrayBuffer(jsHandle),
- JSHostImplementation.MappedType.DataView => new DataView(jsHandle),
- JSHostImplementation.MappedType.Function => new Function(jsHandle),
- JSHostImplementation.MappedType.Uint8Array => new Uint8Array(jsHandle),
+ LegacyHostImplementation.MappedType.JSObject => new JSObject(jsHandle),
+ LegacyHostImplementation.MappedType.Array => new Array(jsHandle),
+ LegacyHostImplementation.MappedType.ArrayBuffer => new ArrayBuffer(jsHandle),
+ LegacyHostImplementation.MappedType.DataView => new DataView(jsHandle),
+ LegacyHostImplementation.MappedType.Function => new Function(jsHandle),
+ LegacyHostImplementation.MappedType.Uint8Array => new Uint8Array(jsHandle),
_ => throw new ArgumentOutOfRangeException(nameof(mappedType))
};
#pragma warning restore CS0612 // Type or member is obsolete
@@ -265,8 +265,8 @@ public static string GetCallSignatureRef(IntPtr _methodHandle, in object objForR
for (int i = 0; i < parmsLength; i++)
{
Type t = parms[i].ParameterType;
- var mt = JSHostImplementation.GetMarshalTypeFromType(t);
- result[i] = JSHostImplementation.GetCallSignatureCharacterForMarshalType(mt, null);
+ var mt = LegacyHostImplementation.GetMarshalTypeFromType(t);
+ result[i] = LegacyHostImplementation.GetCallSignatureCharacterForMarshalType(mt, null);
}
return new string(result);
diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.Types.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.Types.cs
index 3009089133e70..83247d1976027 100644
--- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.Types.cs
+++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.Types.cs
@@ -24,61 +24,5 @@ public struct IntPtrAndHandle
[FieldOffset(0)]
internal RuntimeTypeHandle typeHandle;
}
-
- // see src/mono/wasm/driver.c MARSHAL_TYPE_xxx
- public enum MarshalType : int
- {
- NULL = 0,
- INT = 1,
- FP64 = 2,
- STRING = 3,
- VT = 4,
- DELEGATE = 5,
- TASK = 6,
- OBJECT = 7,
- BOOL = 8,
- ENUM = 9,
- URI = 22,
- SAFEHANDLE = 23,
- ARRAY_BYTE = 10,
- ARRAY_UBYTE = 11,
- ARRAY_UBYTE_C = 12,
- ARRAY_SHORT = 13,
- ARRAY_USHORT = 14,
- ARRAY_INT = 15,
- ARRAY_UINT = 16,
- ARRAY_FLOAT = 17,
- ARRAY_DOUBLE = 18,
- FP32 = 24,
- UINT32 = 25,
- INT64 = 26,
- UINT64 = 27,
- CHAR = 28,
- STRING_INTERNED = 29,
- VOID = 30,
- ENUM64 = 31,
- POINTER = 32
- }
-
- // see src/mono/wasm/driver.c MARSHAL_ERROR_xxx
- public enum MarshalError : int
- {
- BUFFER_TOO_SMALL = 512,
- NULL_CLASS_POINTER = 513,
- NULL_TYPE_POINTER = 514,
- UNSUPPORTED_TYPE = 515,
- FIRST = BUFFER_TOO_SMALL
- }
-
- // please keep BINDING wasm_type_symbol in sync
- public enum MappedType
- {
- JSObject = 0,
- Array = 1,
- ArrayBuffer = 2,
- DataView = 3,
- Function = 4,
- Uint8Array = 11,
- }
}
}
diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs
index 52876f984a02d..6994ca399aa74 100644
--- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs
+++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs
@@ -13,21 +13,12 @@ namespace System.Runtime.InteropServices.JavaScript
internal static partial class JSHostImplementation
{
private const string TaskGetResultName = "get_Result";
- private static readonly MethodInfo s_taskGetResultMethodInfo = typeof(Task<>).GetMethod(TaskGetResultName)!;
+ private static MethodInfo? s_taskGetResultMethodInfo;
// we use this to maintain identity of JSHandle for a JSObject proxy
public static readonly Dictionary> s_csOwnedObjects = new Dictionary>();
// we use this to maintain identity of GCHandle for a managed object
public static Dictionary