67 references to DotNetDispatcher
Microsoft.AspNetCore.Components.Server (3)
Circuits\CircuitHost.cs (3)
389
DotNetDispatcher
.BeginInvokeDotNet(JSRuntime, invocationInfo, argsJson);
423
DotNetDispatcher
.EndInvokeJS(JSRuntime, arguments);
448
DotNetDispatcher
.ReceiveByteArray(JSRuntime, id, data);
Microsoft.AspNetCore.Components.WebAssembly (4)
Services\DefaultWebAssemblyJSRuntime.cs (4)
51
return
DotNetDispatcher
.Invoke(Instance, callInfo, argsJson);
62
DotNetDispatcher
.EndInvokeJS(Instance, argsJson);
91
DotNetDispatcher
.BeginInvokeDotNet(Instance, state.callInfo, state.argsJson);
156
DotNetDispatcher
.ReceiveByteArray(Instance, id, data);
Microsoft.AspNetCore.Components.WebView (3)
IpcReceiver.cs (3)
77
DotNetDispatcher
.BeginInvokeDotNet(
85
DotNetDispatcher
.EndInvokeJS(pageContext.JSRuntime, argumentsOrError);
90
DotNetDispatcher
.ReceiveByteArray(pageContext.JSRuntime, id, data);
Microsoft.JSInterop (3)
Infrastructure\DotNetDispatcher.cs (2)
16
[assembly: MetadataUpdateHandler(typeof(Microsoft.JSInterop.Infrastructure.
DotNetDispatcher
.MetadataUpdateHandler))]
35
private static readonly MethodInfo _taskConverterMethodInfo = typeof(
DotNetDispatcher
).GetMethod(nameof(CreateValueTaskConverter), BindingFlags.NonPublic | BindingFlags.Static)!;
Infrastructure\DotNetObjectReferenceJsonConverter.cs (1)
18
private static JsonEncodedText DotNetObjectRefKey =>
DotNetDispatcher
.DotNetObjectRefKey;
Microsoft.JSInterop.Tests (54)
Infrastructure\DotNetDispatcherTest.cs (54)
22
() =>
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo(assemblyName, "SomeMethod", default, default), "[]"),
34
() =>
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo("SomeAssembly", methodIdentifier, default, default), "[]"),
45
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo(assemblyName, "SomeMethod", default, default), null);
67
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo(thisAssemblyName, methodIdentifier, default, default), null);
79
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticVoid", default, default), null);
91
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticNonVoid", default, default), null);
104
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, nameof(SomePublicType.InvokableMethodWithoutCustomIdentifier), default, default), null);
130
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, default), argsJson);
145
Assert.True(resultDto2Ref.TryGetProperty(
DotNetDispatcher
.DotNetObjectRefKey.EncodedUtf8Bytes, out var property));
171
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, method, default, default), argsJson));
185
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, default), null);
202
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "BaseClassInvokableInstanceVoid", 1, default), null);
219
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null, "__Dispose", objectRef.ObjectId, default), null);
240
() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, default), null));
259
() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, default), null));
273
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
294
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
310
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
331
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
346
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, ""));
357
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"{{\"key\": \"{jsRuntime.LastInvocationAsyncHandle}\"}}"));
368
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false"));
379
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false, \"Hello\", 5]"));
394
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false, \"Hello\", 5]");
409
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, {{\"intVal\": 7}}]");
424
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, [1, 2, 3]]");
438
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, null]");
459
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceMethod", 1, default), argsJson);
478
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, nameof(GenericType<int>.EchoStringParameter), 1, default), argsJson);
494
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, nameof(GenericType<string>.EchoParameter), 1, default), argsJson);
510
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "MultipleJSInvokableAttributesInstance", 1, default), argsJson);
511
var resultJson2 =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "Alias", 1, default), argsJson);
522
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticNonVoidAlias1", default, default), null);
525
var resultJson2 =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticNonVoidAlias2", default, default), null);
543
var ex = Assert.Throws<ArgumentException>(() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, methodIdentifier, 0, default), "[7]"));
558
var ex = Assert.Throws<ArgumentException>(() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, methodIdentifier, 1, default), argsJson));
573
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, nameof(GenericType<int>.EchoParameter), 1, default), argsJson));
590
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, default), argsJson);
613
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, default), argsJson);
640
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null, "InvokableAsyncMethod", 1, callId), argsJson);
679
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null,
703
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null,
721
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, nameof(ThrowingClass.ThrowingMethod), default, callId), default);
743
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, nameof(ThrowingClass.AsyncThrowingMethod), default, callId), default);
763
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, callId), "<xml>not json</xml>");
781
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, callId), null);
795
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string) }));
804
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string) }));
813
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string) }));
823
var result =
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string), typeof(int), });
836
var result =
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(TestDTO), });
851
var result =
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(int), typeof(TestDTO), });
868
var ex = Assert.Throws<InvalidOperationException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), method, arguments, new[] { typeof(int), typeof(TestDTO), }));
882
DotNetDispatcher
.ReceiveByteArray(jsRuntime, 0, byteArray);