File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
4+ using System . Reflection ;
5+
46namespace Microsoft . JSInterop
57{
68 internal static class JSCallResultTypeHelper
79 {
10+ // We avoid using Assembly.GetExecutingAssembly() because this is shared code.
11+ private static readonly Assembly _currentAssembly = typeof ( JSCallResultType ) . Assembly ;
12+
813 public static JSCallResultType FromGeneric < TResult > ( )
9- => typeof ( TResult ) == typeof ( IJSObjectReference )
10- || typeof ( TResult ) == typeof ( IJSInProcessObjectReference )
11- || typeof ( TResult ) == typeof ( IJSUnmarshalledObjectReference ) ?
12- JSCallResultType . JSObjectReference :
13- JSCallResultType . Default ;
14+ {
15+ if ( typeof ( TResult ) . Assembly == _currentAssembly
16+ && ( typeof ( TResult ) == typeof ( IJSObjectReference )
17+ || typeof ( TResult ) == typeof ( IJSInProcessObjectReference )
18+ || typeof ( TResult ) == typeof ( IJSUnmarshalledObjectReference ) ) )
19+ {
20+ return JSCallResultType . JSObjectReference ;
21+ }
22+ else
23+ {
24+ return JSCallResultType . Default ;
25+ }
26+ }
1427 }
1528}
You can’t perform that action at this time.
0 commit comments