1 instantiation of DotNetObjectReference
Microsoft.JSInterop (1)
DotNetObjectReference.cs (1)
23return new DotNetObjectReference<TValue>(value);
106 references to DotNetObjectReference
Aspire.Dashboard (3)
Components\Controls\Chart\PlotlyChart.razor.cs (1)
38private DotNetObjectReference<ChartInterop>? _chartInteropReference;
Components\Layout\MainLayout.razor.cs (2)
25private DotNetObjectReference<ShortcutManager>? _shortcutManagerReference; 26private DotNetObjectReference<MainLayout>? _layoutReference;
BasicTestApp (34)
EventCustomArgsTypes.cs (1)
36public DotNetObjectReference<DotNetType> DotNetObject { get; set; }
InteropTest\JavaScriptInterop.cs (31)
51DotNetObjectReference<TestDTO> parameter3) 60DotNetObjectReference<TestDTO> parameter3, 70DotNetObjectReference<TestDTO> parameter3, 81DotNetObjectReference<TestDTO> parameter3, 93DotNetObjectReference<TestDTO> parameter3, 106DotNetObjectReference<TestDTO> parameter3, 140DotNetObjectReference<TestDTO> parameter3) 149DotNetObjectReference<TestDTO> parameter3, 159DotNetObjectReference<TestDTO> parameter3, 169DotNetObjectReference<TestDTO> parameter3, 180DotNetObjectReference<TestDTO> parameter3, 193DotNetObjectReference<TestDTO> parameter3, 230DotNetObjectReference<TestDTO> parameter3) 240DotNetObjectReference<TestDTO> parameter3, 251DotNetObjectReference<TestDTO> parameter3, 263DotNetObjectReference<TestDTO> parameter3, 276DotNetObjectReference<TestDTO> parameter3, 290DotNetObjectReference<TestDTO> parameter3, 325DotNetObjectReference<TestDTO> parameter3) 334DotNetObjectReference<TestDTO> parameter3, 344DotNetObjectReference<TestDTO> parameter3, 354DotNetObjectReference<TestDTO> parameter3, 366DotNetObjectReference<TestDTO> parameter3, 379DotNetObjectReference<TestDTO> parameter3, 390public static Dictionary<string, DotNetObjectReference<TestDTO>> ReturnDotNetObjectByRef() 392return new Dictionary<string, DotNetObjectReference<TestDTO>> 399public static async Task<Dictionary<string, DotNetObjectReference<TestDTO>>> ReturnDotNetObjectByRefAsync() 402return new Dictionary<string, DotNetObjectReference<TestDTO>> 409public static int ExtractNonSerializedValue(DotNetObjectReference<TestDTO> objectByRef) 490public DotNetObjectReference<TestDTO> DTOByRef { get; set; } 501public DotNetObjectReference<TestDTO> OutgoingByRef { get; set; }
ServerReliability\JSInterop.cs (2)
11public static DotNetObjectReference<ImportantInformation> CreateImportant() 17public static string ReceiveTrivial(DotNetObjectReference<TrivialInformation> information)
Microsoft.AspNetCore.Components.Web (3)
Virtualization\VirtualizeJsInterop.cs (1)
17private DotNetObjectReference<VirtualizeJsInterop>? _selfReference;
WebRenderer.cs (2)
22private readonly DotNetObjectReference<WebRendererInteropMethods> _interopMethodsReference; 131newJsonOptions.TypeInfoResolverChain.Add(JsonConverterFactoryTypeInfoResolver<DotNetObjectReference<WebRendererInteropMethods>>.Instance);
Microsoft.JSInterop (16)
DotNetObjectReference.cs (4)
10/// Provides convenience methods to produce a <see cref="DotNetObjectReference{TValue}" />. 15/// Creates a new instance of <see cref="DotNetObjectReference{TValue}" />. 18/// <returns>An instance of <see cref="DotNetObjectReference{TValue}" />.</returns> 19public static DotNetObjectReference<TValue> Create<[DynamicallyAccessedMembers(JSInvokable)] TValue>(TValue value) where TValue : class
DotNetObjectReferenceOfT.cs (1)
26/// Initializes a new instance of <see cref="DotNetObjectReference{TValue}" />.
Infrastructure\DotNetDispatcher.cs (1)
275return !parameterType.IsGenericType || parameterType.GetGenericTypeDefinition() != typeof(DotNetObjectReference<>);
Infrastructure\DotNetObjectReferenceJsonConverter.cs (5)
11internal sealed class DotNetObjectReferenceJsonConverter<[DynamicallyAccessedMembers(JSInvokable)] TValue> : JsonConverter<DotNetObjectReference<TValue>> where TValue : class 22public override DotNetObjectReference<TValue> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 51var value = (DotNetObjectReference<TValue>)JSRuntime.GetObjectReference(dotNetObjectId); 55public override void Write(Utf8JsonWriter writer, DotNetObjectReference<TValue> value, JsonSerializerOptions options)
Infrastructure\DotNetObjectReferenceJsonConverterFactory.cs (1)
21return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(DotNetObjectReference<>);
JSRuntime.cs (4)
295internal long TrackObjectReference<[DynamicallyAccessedMembers(JSInvokable)] TValue>(DotNetObjectReference<TValue> dotNetObjectReference) where TValue : class 314$" A common cause is caching an instance of {nameof(DotNetObjectReference<TValue>)} globally. Consider creating instances of {nameof(DotNetObjectReference<TValue>)} at the JSInterop callsite."); 332/// <param name="dotNetObjectId">The ID of the <see cref="DotNetObjectReference{TValue}"/>.</param>
Microsoft.JSInterop.Tests (50)
DotNetObjectReferenceTest.cs (7)
20var objRef = DotNetObjectReference.Create(new object()); 35var objRef = DotNetObjectReference.Create(new object()); 49var objRef = DotNetObjectReference.Create("Hello world"); 50var expected = $"{objRef.GetType().Name} is already being tracked by a different instance of {nameof(JSRuntime)}. A common cause is caching an instance of {nameof(DotNetObjectReference<string>)}" + 51$" globally. Consider creating instances of {nameof(DotNetObjectReference<string>)} at the JSInterop callsite."; 67var objRef = DotNetObjectReference.Create("Hello world"); 86var objRef = DotNetObjectReference.Create("Hello world");
Infrastructure\DotNetDispatcherTest.cs (20)
117var objectRef = DotNetObjectReference.Create(arg3); 145var resultDto2 = Assert.IsType<DotNetObjectReference<TestDTO>>(jsRuntime.GetObjectReference(property.GetInt64())).Value; 157var objectRef = DotNetObjectReference.Create(arg3); 180var objectRef = DotNetObjectReference.Create(targetInstance); 197var objectRef = DotNetObjectReference.Create(targetInstance); 214var objectRef = DotNetObjectReference.Create(targetInstance); 233var objectRef = DotNetObjectReference.Create(targetInstance); 252var objectRef = DotNetObjectReference.Create(targetInstance); 462var resultDto = ((DotNetObjectReference<TestDTO>)jsRuntime.GetObjectReference(3)).Value; 564var objectRef = DotNetObjectReference.Create(new TestDTO { IntVal = 4 }); 589var arg1Ref = DotNetObjectReference.Create(targetInstance); 590var arg2Ref = DotNetObjectReference.Create(arg2); 628var arg1Ref = DotNetObjectReference.Create(targetInstance); 629var arg2Ref = DotNetObjectReference.Create(arg2); 657var arg1Ref = DotNetObjectReference.Create(targetInstance); 878public static object[] MyInvocableWithParams(TestDTO dtoViaJson, int[] incrementAmounts, DotNetObjectReference<TestDTO> dtoByRef) 908public object[] InvokableInstanceMethod(string someString, DotNetObjectReference<TestDTO> someDTORef) 925public async Task<InvokableAsyncMethodResult> InvokableAsyncMethod(TestDTO dtoViaJson, DotNetObjectReference<TestDTO> dtoByRefWrapper) 945public async ValueTask<InvokableAsyncMethodResult> InvokableAsyncMethodReturningValueTask(TestDTO dtoViaJson, DotNetObjectReference<TestDTO> dtoByRefWrapper) 973public DotNetObjectReference<TestDTO> SomeDTORef { get; set; }
Infrastructure\DotNetObjectReferenceJsonConverterTest.cs (18)
18var dotNetObjectRef = DotNetObjectReference.Create(new TestModel()); 23var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions)); 32var dotNetObjectRef = DotNetObjectReference.Create(new TestModel()); 37var ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions)); 46var dotNetObjectRef = DotNetObjectReference.Create(input); 52var ex = Record.Exception(() => JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions)); 61var dotNetObjectRef = DotNetObjectReference.Create(input); 67var ex = Record.Exception(() => JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions)); 76var dotNetObjectRef = DotNetObjectReference.Create(input); 82var deserialized = JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions)!; 96var ref1 = DotNetObjectReference.Create(instance1); 97var ref2 = DotNetObjectReference.Create(instance2); 102var deserialized = JsonSerializer.Deserialize<DotNetObjectReference<TestModel>[]>(json, JsonSerializerOptions)!; 114var dotNetObjectRef = DotNetObjectReference.Create(input); 123var deserialized = JsonSerializer.Deserialize<DotNetObjectReference<TestModel>>(json, JsonSerializerOptions)!; 134var dotNetObjectRef = DotNetObjectReference.Create(new TestModel());
JSInProcessRuntimeTest.cs (3)
41var syncResult = runtime.Invoke<DotNetObjectReference<object>>("test identifier", 75var syncResult = runtime.Invoke<DotNetObjectReference<object>[]>(
JSRuntimeTest.cs (2)
271var obj1Ref = DotNetObjectReference.Create(obj1); 272var obj1DifferentRef = DotNetObjectReference.Create(obj1);