diff --git a/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt b/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt index cbb05786f46b..8baa99e23137 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt +++ b/src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt @@ -13,11 +13,27 @@ Microsoft.JSInterop.IJSObjectReference.InvokeAsync(string! identifier, o Microsoft.JSInterop.IJSRuntime Microsoft.JSInterop.IJSRuntime.InvokeAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask Microsoft.JSInterop.IJSRuntime.InvokeAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.IJSUnmarshalledObjectReference +Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled(string! identifier, T0 arg0, T1 arg1, T2 arg2) -> TResult +Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled(string! identifier, T0 arg0, T1 arg1) -> TResult +Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled(string! identifier, T0 arg0) -> TResult +Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled(string! identifier) -> TResult Microsoft.JSInterop.IJSUnmarshalledRuntime Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled(string! identifier, T0 arg0, T1 arg1, T2 arg2) -> TResult Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled(string! identifier, T0 arg0, T1 arg1) -> TResult Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled(string! identifier, T0 arg0) -> TResult Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled(string! identifier) -> TResult +Microsoft.JSInterop.Implementation.JSInProcessObjectReference +Microsoft.JSInterop.Implementation.JSInProcessObjectReference.Dispose() -> void +Microsoft.JSInterop.Implementation.JSInProcessObjectReference.Invoke(string! identifier, params object?[]? args) -> TValue +Microsoft.JSInterop.Implementation.JSInProcessObjectReference.JSInProcessObjectReference(Microsoft.JSInterop.JSInProcessRuntime! jsRuntime, long id) -> void +Microsoft.JSInterop.Implementation.JSObjectReference +Microsoft.JSInterop.Implementation.JSObjectReference.DisposeAsync() -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.Implementation.JSObjectReference.Id.get -> long +Microsoft.JSInterop.Implementation.JSObjectReference.InvokeAsync(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.Implementation.JSObjectReference.InvokeAsync(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask +Microsoft.JSInterop.Implementation.JSObjectReference.JSObjectReference(Microsoft.JSInterop.JSRuntime! jsRuntime, long id) -> void +Microsoft.JSInterop.Implementation.JSObjectReference.ThrowIfDisposed() -> void Microsoft.JSInterop.Infrastructure.DotNetDispatcher Microsoft.JSInterop.Infrastructure.DotNetInvocationInfo Microsoft.JSInterop.Infrastructure.DotNetInvocationInfo.AssemblyName.get -> string? diff --git a/src/Shared/JSInterop/JSCallResultTypeHelper.cs b/src/Shared/JSInterop/JSCallResultTypeHelper.cs index 82c3920c7210..8bf1a547fc1b 100644 --- a/src/Shared/JSInterop/JSCallResultTypeHelper.cs +++ b/src/Shared/JSInterop/JSCallResultTypeHelper.cs @@ -1,15 +1,28 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System.Reflection; + namespace Microsoft.JSInterop { internal static class JSCallResultTypeHelper { + // We avoid using Assembly.GetExecutingAssembly() because this is shared code. + private static readonly Assembly _currentAssembly = typeof(JSCallResultType).Assembly; + public static JSCallResultType FromGeneric() - => typeof(TResult) == typeof(IJSObjectReference) - || typeof(TResult) == typeof(IJSInProcessObjectReference) - || typeof(TResult) == typeof(IJSUnmarshalledObjectReference) ? - JSCallResultType.JSObjectReference : - JSCallResultType.Default; + { + if (typeof(TResult).Assembly == _currentAssembly + && (typeof(TResult) == typeof(IJSObjectReference) + || typeof(TResult) == typeof(IJSInProcessObjectReference) + || typeof(TResult) == typeof(IJSUnmarshalledObjectReference))) + { + return JSCallResultType.JSObjectReference; + } + else + { + return JSCallResultType.Default; + } + } } }