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
16 changes: 16 additions & 0 deletions src/JSInterop/Microsoft.JSInterop/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,27 @@ Microsoft.JSInterop.IJSObjectReference.InvokeAsync<TValue>(string! identifier, o
Microsoft.JSInterop.IJSRuntime
Microsoft.JSInterop.IJSRuntime.InvokeAsync<TValue>(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask<TValue>
Microsoft.JSInterop.IJSRuntime.InvokeAsync<TValue>(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask<TValue>
Microsoft.JSInterop.IJSUnmarshalledObjectReference
Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled<T0, T1, T2, TResult>(string! identifier, T0 arg0, T1 arg1, T2 arg2) -> TResult
Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled<T0, T1, TResult>(string! identifier, T0 arg0, T1 arg1) -> TResult
Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled<T0, TResult>(string! identifier, T0 arg0) -> TResult
Microsoft.JSInterop.IJSUnmarshalledObjectReference.InvokeUnmarshalled<TResult>(string! identifier) -> TResult
Microsoft.JSInterop.IJSUnmarshalledRuntime
Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled<T0, T1, T2, TResult>(string! identifier, T0 arg0, T1 arg1, T2 arg2) -> TResult
Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled<T0, T1, TResult>(string! identifier, T0 arg0, T1 arg1) -> TResult
Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled<T0, TResult>(string! identifier, T0 arg0) -> TResult
Microsoft.JSInterop.IJSUnmarshalledRuntime.InvokeUnmarshalled<TResult>(string! identifier) -> TResult
Microsoft.JSInterop.Implementation.JSInProcessObjectReference
Microsoft.JSInterop.Implementation.JSInProcessObjectReference.Dispose() -> void
Microsoft.JSInterop.Implementation.JSInProcessObjectReference.Invoke<TValue>(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<TValue>(string! identifier, System.Threading.CancellationToken cancellationToken, object?[]? args) -> System.Threading.Tasks.ValueTask<TValue>
Microsoft.JSInterop.Implementation.JSObjectReference.InvokeAsync<TValue>(string! identifier, object?[]? args) -> System.Threading.Tasks.ValueTask<TValue>
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?
Expand Down
23 changes: 18 additions & 5 deletions src/Shared/JSInterop/JSCallResultTypeHelper.cs
Original file line number Diff line number Diff line change
@@ -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<TResult>()
=> 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;
}
}
}
}