67 references to DotNetDispatcher
Microsoft.AspNetCore.Components.Server (3)
Circuits\CircuitHost.cs (3)
379
DotNetDispatcher
.BeginInvokeDotNet(JSRuntime, invocationInfo, argsJson);
413
DotNetDispatcher
.EndInvokeJS(JSRuntime, arguments);
438
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)
21
() =>
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo(assemblyName, "SomeMethod", default, default), "[]"),
33
() =>
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo("SomeAssembly", methodIdentifier, default, default), "[]"),
44
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo(assemblyName, "SomeMethod", default, default), null);
66
DotNetDispatcher
.Invoke(new TestJSRuntime(), new DotNetInvocationInfo(thisAssemblyName, methodIdentifier, default, default), null);
78
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticVoid", default, default), null);
90
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticNonVoid", default, default), null);
103
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, nameof(SomePublicType.InvokableMethodWithoutCustomIdentifier), default, default), null);
129
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, default), argsJson);
144
Assert.True(resultDto2Ref.TryGetProperty(
DotNetDispatcher
.DotNetObjectRefKey.EncodedUtf8Bytes, out var property));
170
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, method, default, default), argsJson));
184
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, default), null);
201
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "BaseClassInvokableInstanceVoid", 1, default), null);
218
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null, "__Dispose", objectRef.ObjectId, default), null);
239
() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, default), null));
258
() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, default), null));
272
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
293
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
309
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
330
DotNetDispatcher
.EndInvokeJS(jsRuntime, argsJson);
345
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, ""));
356
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"{{\"key\": \"{jsRuntime.LastInvocationAsyncHandle}\"}}"));
367
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false"));
378
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false, \"Hello\", 5]"));
393
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false, \"Hello\", 5]");
408
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, {{\"intVal\": 7}}]");
423
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, [1, 2, 3]]");
437
DotNetDispatcher
.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, null]");
458
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceMethod", 1, default), argsJson);
477
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, nameof(GenericType<int>.EchoStringParameter), 1, default), argsJson);
493
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, nameof(GenericType<string>.EchoParameter), 1, default), argsJson);
509
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "MultipleJSInvokableAttributesInstance", 1, default), argsJson);
510
var resultJson2 =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, "Alias", 1, default), argsJson);
521
var resultJson =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticNonVoidAlias1", default, default), null);
524
var resultJson2 =
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticNonVoidAlias2", default, default), null);
542
var ex = Assert.Throws<ArgumentException>(() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, methodIdentifier, 0, default), "[7]"));
557
var ex = Assert.Throws<ArgumentException>(() =>
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, methodIdentifier, 1, default), argsJson));
572
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(null, nameof(GenericType<int>.EchoParameter), 1, default), argsJson));
589
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, default), argsJson);
612
DotNetDispatcher
.Invoke(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, default), argsJson);
639
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null, "InvokableAsyncMethod", 1, callId), argsJson);
678
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null,
702
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null,
720
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, nameof(ThrowingClass.ThrowingMethod), default, callId), default);
742
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, nameof(ThrowingClass.AsyncThrowingMethod), default, callId), default);
762
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(thisAssemblyName, "InvocableStaticWithParams", default, callId), "<xml>not json</xml>");
780
DotNetDispatcher
.BeginInvokeDotNet(jsRuntime, new DotNetInvocationInfo(null, "InvokableInstanceVoid", 1, callId), null);
794
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string) }));
803
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string) }));
812
Assert.ThrowsAny<JsonException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string) }));
822
var result =
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(string), typeof(int), });
835
var result =
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(TestDTO), });
850
var result =
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), "SomeMethod", arguments, new[] { typeof(int), typeof(TestDTO), });
867
var ex = Assert.Throws<InvalidOperationException>(() =>
DotNetDispatcher
.ParseArguments(new TestJSRuntime(), method, arguments, new[] { typeof(int), typeof(TestDTO), }));
881
DotNetDispatcher
.ReceiveByteArray(jsRuntime, 0, byteArray);