Skip to content

Commit e6f27b0

Browse files
authored
Merge pull request #42814 from pavelsavara/new_js_interop_minimal
[blazor] Obsolete InvokeUnmarshalled
2 parents 0602a32 + 5995535 commit e6f27b0

17 files changed

+330
-30
lines changed

src/Components/Web.JS/@types/dotnet/dotnet.d.ts

Lines changed: 239 additions & 19 deletions
Large diffs are not rendered by default.

src/Components/Web.JS/src/Boot.WebAssembly.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ async function boot(options?: Partial<WebAssemblyStartOptions>): Promise<void> {
142142
jsInitializer.invokeAfterStartedCallbacks(Blazor);
143143
}
144144

145+
// obsolete, legacy, don't use for new code!
145146
function invokeJSFromDotNet(callInfo: Pointer, arg0: any, arg1: any, arg2: any): any {
146147
const functionIdentifier = monoPlatform.readStringField(callInfo, 0)!;
147148
const resultType = monoPlatform.readInt32Field(callInfo, 4);

src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { DotnetPublicAPI, BINDINGType, CreateDotnetRuntimeType, DotnetModuleConf
1818
export let BINDING: BINDINGType = undefined as any;
1919
export let MONO: MONOType = undefined as any;
2020
export let Module: DotnetModuleConfig & EmscriptenModule = undefined as any;
21+
export let IMPORTS: any = undefined as any;
2122

2223
const appBinDirName = 'appBinDir';
2324
const uint64HighOrderShift = Math.pow(2, 32);
@@ -300,18 +301,19 @@ async function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourc
300301
const createDotnetRuntime = await dotnetJsBeingLoaded;
301302

302303
await createDotnetRuntime((api) => {
303-
const { MONO: mono, BINDING: binding, Module: module } = api;
304+
const { MONO: mono, BINDING: binding, Module: module, IMPORTS: imports } = api;
304305
Module = module;
305306
BINDING = binding;
306307
MONO = mono;
308+
IMPORTS = imports;
307309

308310
// Override the mechanism for fetching the main wasm file so we can connect it to our cache
309-
const instantiateWasm = (imports, successCallback) => {
311+
const instantiateWasm = (wasmImports, successCallback) => {
310312
(async () => {
311313
let compiledInstance: WebAssembly.Instance;
312314
try {
313315
const dotnetWasmResource = await wasmBeingLoaded;
314-
compiledInstance = await compileWasmModule(dotnetWasmResource, imports);
316+
compiledInstance = await compileWasmModule(dotnetWasmResource, wasmImports);
315317
} catch (ex) {
316318
printErr((ex as Error).toString());
317319
throw ex;
@@ -343,9 +345,7 @@ async function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourc
343345
assembliesBeingLoaded.forEach(r => addResourceAsAssembly(r, changeExtension(r.name, '.dll')));
344346
pdbsBeingLoaded.forEach(r => addResourceAsAssembly(r, r.name));
345347

346-
Blazor._internal.dotNetCriticalError = (message) => {
347-
printErr(BINDING.conv_string(message) || '(null)');
348-
};
348+
Blazor._internal.dotNetCriticalError = (message) => printErr(message || '(null)');
349349

350350
// Wire-up callbacks for satellite assemblies. Blazor will call these as part of the application
351351
// startup sequence to load satellite assemblies for the application's culture.
@@ -481,6 +481,16 @@ async function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourc
481481
// -1 enables debugging with logging disabled. 0 disables debugging entirely.
482482
MONO.mono_wasm_load_runtime(appBinDirName, hasDebuggingEnabled() ? -1 : 0);
483483
MONO.mono_wasm_runtime_ready();
484+
try {
485+
BINDING.bind_static_method('invalid-fqn', '');
486+
} catch (e) {
487+
// HOTFIX: until https://github.com/dotnet/runtime/pull/72275
488+
// this would always throw, but it will initialize runtime interop as side-effect
489+
}
490+
491+
// makes Blazor._internal visible to [JSImport]
492+
IMPORTS.Blazor = { _internal: Blazor._internal };
493+
484494
attachInteropInvoker();
485495
runtimeReadyResolve(api);
486496
};

src/Components/WebAssembly/JSInterop/src/WebAssemblyJSObjectReference.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,37 @@ public WebAssemblyJSObjectReference(WebAssemblyJSRuntime jsRuntime, long id)
1515
_jsRuntime = jsRuntime;
1616
}
1717

18+
#pragma warning disable CS0612 // Type or member is obsolete
19+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
1820
public TResult InvokeUnmarshalled<TResult>(string identifier)
1921
{
2022
ThrowIfDisposed();
2123

2224
return _jsRuntime.InvokeUnmarshalled<object?, object?, object?, TResult>(identifier, null, null, null, Id);
2325
}
2426

27+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
2528
public TResult InvokeUnmarshalled<T0, TResult>(string identifier, T0 arg0)
2629
{
2730
ThrowIfDisposed();
2831

2932
return _jsRuntime.InvokeUnmarshalled<T0, object?, object?, TResult>(identifier, arg0, null, null, Id);
3033
}
3134

35+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
3236
public TResult InvokeUnmarshalled<T0, T1, TResult>(string identifier, T0 arg0, T1 arg1)
3337
{
3438
ThrowIfDisposed();
3539

3640
return _jsRuntime.InvokeUnmarshalled<T0, T1, object?, TResult>(identifier, arg0, arg1, null, Id);
3741
}
3842

43+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
3944
public TResult InvokeUnmarshalled<T0, T1, T2, TResult>(string identifier, T0 arg0, T1 arg1, T2 arg2)
4045
{
4146
ThrowIfDisposed();
4247

4348
return _jsRuntime.InvokeUnmarshalled<T0, T1, T2, TResult>(identifier, arg0, arg1, arg2, Id);
4449
}
50+
#pragma warning restore CS0612 // Type or member is obsolete
4551
}

src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,21 @@ protected override void EndInvokeDotNet(DotNetInvocationInfo callInfo, in DotNet
6363
var resultJsonOrErrorMessage = dispatchResult.Success
6464
? dispatchResult.ResultJson!
6565
: dispatchResult.Exception!.ToString();
66+
#pragma warning disable CS0618 // Type or member is obsolete
6667
InvokeUnmarshalled<string?, bool, string, object>("Blazor._internal.endInvokeDotNetFromJS",
6768
callInfo.CallId, dispatchResult.Success, resultJsonOrErrorMessage);
69+
#pragma warning restore CS0618 // Type or member is obsolete
6870
}
6971

7072
/// <inheritdoc />
7173
protected override void SendByteArray(int id, byte[] data)
7274
{
75+
#pragma warning disable CS0618 // Type or member is obsolete
7376
InvokeUnmarshalled<int, byte[], object>("Blazor._internal.receiveByteArray", id, data);
77+
#pragma warning restore CS0618 // Type or member is obsolete
7478
}
7579

80+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
7681
internal TResult InvokeUnmarshalled<T0, T1, T2, TResult>(string identifier, T0 arg0, T1 arg1, T2 arg2, long targetInstanceId)
7782
{
7883
var resultType = JSCallResultTypeHelper.FromGeneric<TResult>();
@@ -122,18 +127,22 @@ private IJSStreamReference DeserializeJSStreamReference(string serializedStreamR
122127
}
123128

124129
/// <inheritdoc />
130+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
125131
public TResult InvokeUnmarshalled<TResult>(string identifier)
126132
=> InvokeUnmarshalled<object?, object?, object?, TResult>(identifier, null, null, null, 0);
127133

128134
/// <inheritdoc />
135+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
129136
public TResult InvokeUnmarshalled<T0, TResult>(string identifier, T0 arg0)
130137
=> InvokeUnmarshalled<T0, object?, object?, TResult>(identifier, arg0, null, null, 0);
131138

132139
/// <inheritdoc />
140+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
133141
public TResult InvokeUnmarshalled<T0, T1, TResult>(string identifier, T0 arg0, T1 arg1)
134142
=> InvokeUnmarshalled<T0, T1, object?, TResult>(identifier, arg0, arg1, null, 0);
135143

136144
/// <inheritdoc />
145+
[Obsolete("This method is obsolete. Use JSImportAttribute instead.")]
137146
public TResult InvokeUnmarshalled<T0, T1, T2, TResult>(string identifier, T0 arg0, T1 arg1, T2 arg2)
138147
=> InvokeUnmarshalled<T0, T1, T2, TResult>(identifier, arg0, arg1, arg2, 0);
139148
}

src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyCultureProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public virtual async ValueTask LoadCurrentCultureResourcesAsync()
7474
// assemblies. We effectively want to resovle a Task<byte[][]> but there is no way to express this
7575
// using interop. We'll instead do this in two parts:
7676
// getSatelliteAssemblies resolves when all satellite assemblies to be loaded in .NET are fetched and available in memory.
77+
#pragma warning disable CS0618 // Type or member is obsolete
7778
var count = (int)await _invoker.InvokeUnmarshalled<string[], object?, object?, Task<object>>(
7879
GetSatelliteAssemblies,
7980
culturesToLoad.ToArray(),
@@ -91,6 +92,7 @@ public virtual async ValueTask LoadCurrentCultureResourcesAsync()
9192
null,
9293
null,
9394
null);
95+
#pragma warning restore CS0618 // Type or member is obsolete
9496

9597
for (var i = 0; i < assemblies.Length; i++)
9698
{

src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHostBuilder.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ internal WebAssemblyHostBuilder(IJSUnmarshalledRuntime jsRuntime, JsonSerializer
9090
[UnconditionalSuppressMessage("Trimming", "IL2072", Justification = "Root components are expected to be defined in assemblies that do not get trimmed.")]
9191
private void InitializeRegisteredRootComponents(IJSUnmarshalledRuntime jsRuntime)
9292
{
93+
#pragma warning disable CS0618 // Type or member is obsolete
9394
var componentsCount = jsRuntime.InvokeUnmarshalled<int>(RegisteredComponentsInterop.GetRegisteredComponentsCount);
9495
if (componentsCount == 0)
9596
{
@@ -106,6 +107,7 @@ private void InitializeRegisteredRootComponents(IJSUnmarshalledRuntime jsRuntime
106107
var serializedParameterValues = jsRuntime.InvokeUnmarshalled<int, object?, object?, string>(RegisteredComponentsInterop.GetParameterValues, id, null, null);
107108
registeredComponents[i] = new WebAssemblyComponentMarker(WebAssemblyComponentMarker.ClientMarkerType, assembly, typeName, serializedParameterDefinitions, serializedParameterValues, id.ToString(CultureInfo.InvariantCulture));
108109
}
110+
#pragma warning restore CS0618 // Type or member is obsolete
109111

110112
var componentDeserializer = WebAssemblyComponentParameterDeserializer.Instance;
111113
foreach (var registeredComponent in registeredComponents)
@@ -129,20 +131,26 @@ private void InitializeRegisteredRootComponents(IJSUnmarshalledRuntime jsRuntime
129131

130132
private void InitializePersistedState(IJSUnmarshalledRuntime jsRuntime)
131133
{
134+
#pragma warning disable CS0618 // Type or member is obsolete
132135
_persistedState = jsRuntime.InvokeUnmarshalled<string>("Blazor._internal.getPersistedState");
136+
#pragma warning restore CS0618 // Type or member is obsolete
133137
}
134138

135139
private static void InitializeNavigationManager(IJSUnmarshalledRuntime jsRuntime)
136140
{
141+
#pragma warning disable CS0618 // Type or member is obsolete
137142
var baseUri = jsRuntime.InvokeUnmarshalled<string>(BrowserNavigationManagerInterop.GetBaseUri);
138143
var uri = jsRuntime.InvokeUnmarshalled<string>(BrowserNavigationManagerInterop.GetLocationHref);
144+
#pragma warning restore CS0618 // Type or member is obsolete
139145

140146
WebAssemblyNavigationManager.Instance = new WebAssemblyNavigationManager(baseUri, uri);
141147
}
142148

143149
private WebAssemblyHostEnvironment InitializeEnvironment(IJSUnmarshalledRuntime jsRuntime)
144150
{
151+
#pragma warning disable CS0618 // Type or member is obsolete
145152
var applicationEnvironment = jsRuntime.InvokeUnmarshalled<string>("Blazor._internal.getApplicationEnvironment");
153+
#pragma warning restore CS0618 // Type or member is obsolete
146154
var hostEnvironment = new WebAssemblyHostEnvironment(applicationEnvironment, WebAssemblyNavigationManager.Instance.BaseUri);
147155

148156
Services.AddSingleton<IWebAssemblyHostEnvironment>(hostEnvironment);
@@ -155,8 +163,10 @@ private WebAssemblyHostEnvironment InitializeEnvironment(IJSUnmarshalledRuntime
155163

156164
foreach (var configFile in configFiles)
157165
{
166+
#pragma warning disable CS0618 // Type or member is obsolete
158167
var appSettingsJson = jsRuntime.InvokeUnmarshalled<string, byte[]>(
159168
"Blazor._internal.getConfig", configFile);
169+
#pragma warning restore CS0618 // Type or member is obsolete
160170

161171
if (appSettingsJson != null)
162172
{

src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ internal static async Task InitializeAsync()
3535
// See https://github.com/dotnet/aspnetcore/issues/37357#issuecomment-941237000
3636

3737
var jsObjectReference = (IJSUnmarshalledObjectReference)(await DefaultWebAssemblyJSRuntime.Instance.InvokeAsync<IJSObjectReference>("import", "/_framework/blazor-hotreload.js"));
38+
#pragma warning disable CS0618 // Type or member is obsolete
3839
await jsObjectReference.InvokeUnmarshalled<Task<int>>("receiveHotReload");
40+
#pragma warning restore CS0618 // Type or member is obsolete
3941
}
4042
}
4143

src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<Nullable>enable</Nullable>
1111
<IsTrimmable>true</IsTrimmable>
12+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1213
</PropertyGroup>
1314

1415
<ItemGroup>

src/Components/WebAssembly/WebAssembly/src/Rendering/WebAssemblyRenderer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ protected override void ProcessPendingRender()
8383
/// <inheritdoc />
8484
protected override Task UpdateDisplayAsync(in RenderBatch batch)
8585
{
86+
#pragma warning disable CS0618 // Type or member is obsolete
8687
DefaultWebAssemblyJSRuntime.Instance.InvokeUnmarshalled<int, RenderBatch, object>(
8788
"Blazor._internal.renderBatch",
8889
RendererId,
8990
batch);
91+
#pragma warning restore CS0618 // Type or member is obsolete
9092

9193
if (WebAssemblyCallQueue.HasUnstartedWork)
9294
{

src/Components/WebAssembly/WebAssembly/src/Services/DefaultWebAssemblyJSRuntime.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ public static void BeginInvokeDotNet(string callId, string assemblyNameOrDotNetO
8686
/// <param name="id">Id of the byte array</param>
8787
public static void NotifyByteArrayAvailable(int id)
8888
{
89+
#pragma warning disable CS0618 // Type or member is obsolete
8990
var data = Instance.InvokeUnmarshalled<byte[]>("Blazor._internal.retrieveByteArray");
91+
#pragma warning restore CS0618 // Type or member is obsolete
9092

9193
DotNetDispatcher.ReceiveByteArray(Instance, id, data);
9294
}

src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,22 @@ private async Task<IEnumerable<Assembly>> LoadAssembliesInClientAsync(IEnumerabl
105105
}
106106

107107
var jsRuntime = (IJSUnmarshalledRuntime)_jsRuntime;
108+
#pragma warning disable CS0618 // Type or member is obsolete
108109
var count = (int)await jsRuntime.InvokeUnmarshalled<string[], Task<object>>(
109110
GetLazyAssemblies,
110111
newAssembliesToLoad.ToArray());
112+
#pragma warning restore CS0618 // Type or member is obsolete
111113

112114
if (count == 0)
113115
{
114116
return Array.Empty<Assembly>();
115117
}
116118

117119
var loadedAssemblies = new List<Assembly>();
120+
#pragma warning disable CS0618 // Type or member is obsolete
118121
var assemblies = jsRuntime.InvokeUnmarshalled<byte[][]>(ReadLazyAssemblies);
119122
var pdbs = jsRuntime.InvokeUnmarshalled<byte[][]>(ReadLazyPDBs);
123+
#pragma warning restore CS0618 // Type or member is obsolete
120124

121125
for (int i = 0; i < assemblies.Length; i++)
122126
{

src/Components/WebAssembly/WebAssembly/src/Services/WebAssemblyConsoleLogger.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics;
5+
using System.Runtime.InteropServices.JavaScript;
56
using System.Text;
67
using Microsoft.Extensions.Logging;
78
using Microsoft.JSInterop;
@@ -79,19 +80,19 @@ private void WriteMessage(LogLevel logLevel, string logName, int eventId, string
7980
// messages if you enable "Verbose" in the filter dropdown (which is off
8081
// by default). As such "console.debug" is the best choice for messages
8182
// with a lower severity level than "Information".
82-
_jsRuntime.InvokeVoid("console.debug", formattedMessage);
83+
ConsoleLoggerInterop.ConsoleDebug(formattedMessage);
8384
break;
8485
case LogLevel.Information:
85-
_jsRuntime.InvokeVoid("console.info", formattedMessage);
86+
ConsoleLoggerInterop.ConsoleInfo(formattedMessage);
8687
break;
8788
case LogLevel.Warning:
88-
_jsRuntime.InvokeVoid("console.warn", formattedMessage);
89+
ConsoleLoggerInterop.ConsoleWarn(formattedMessage);
8990
break;
9091
case LogLevel.Error:
91-
_jsRuntime.InvokeVoid("console.error", formattedMessage);
92+
ConsoleLoggerInterop.ConsoleError(formattedMessage);
9293
break;
9394
case LogLevel.Critical:
94-
_jsRuntime.InvokeUnmarshalled<string, object>("Blazor._internal.dotNetCriticalError", formattedMessage);
95+
ConsoleLoggerInterop.DotNetCriticalError(formattedMessage);
9596
break;
9697
default: // invalid enum values
9798
Debug.Assert(logLevel != LogLevel.None, "This method is never called with LogLevel.None.");
@@ -165,3 +166,17 @@ private sealed class NoOpDisposable : IDisposable
165166
public void Dispose() { }
166167
}
167168
}
169+
170+
internal static partial class ConsoleLoggerInterop
171+
{
172+
[JSImport("globalThis.console.debug")]
173+
public static partial void ConsoleDebug(string message);
174+
[JSImport("globalThis.console.info")]
175+
public static partial void ConsoleInfo(string message);
176+
[JSImport("globalThis.console.warn")]
177+
public static partial void ConsoleWarn(string message);
178+
[JSImport("globalThis.console.error")]
179+
public static partial void ConsoleError(string message);
180+
[JSImport("Blazor._internal.dotNetCriticalError")]
181+
public static partial void DotNetCriticalError(string message);
182+
}

src/Components/WebAssembly/WebAssembly/test/Hosting/WebAssemblyCultureProviderTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ public async Task LoadCurrentCultureResourcesAsync_ReadsAssemblies()
3333
// Arrange
3434
using var cultureReplacer = new CultureReplacer("en-GB");
3535
var invoker = new Mock<IJSUnmarshalledRuntime>();
36+
#pragma warning disable CS0618 // Type or member is obsolete
3637
invoker.Setup(i => i.InvokeUnmarshalled<string[], object, object, Task<object>>(GetSatelliteAssemblies, new[] { "en-GB", "en" }, null, null))
3738
.Returns(Task.FromResult<object>(1))
3839
.Verifiable();
3940

4041
invoker.Setup(i => i.InvokeUnmarshalled<object, object, object, object[]>(ReadSatelliteAssemblies, null, null, null))
4142
.Returns(new object[] { File.ReadAllBytes(GetType().Assembly.Location) })
4243
.Verifiable();
44+
#pragma warning restore CS0618 // Type or member is obsolete
4345

4446
var loader = new WebAssemblyCultureProvider(invoker.Object, CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture);
4547

@@ -56,17 +58,21 @@ public async Task LoadCurrentCultureResourcesAsync_DoesNotReadAssembliesWhenTher
5658
// Arrange
5759
using var cultureReplacer = new CultureReplacer("en-GB");
5860
var invoker = new Mock<IJSUnmarshalledRuntime>();
61+
#pragma warning disable CS0618 // Type or member is obsolete
5962
invoker.Setup(i => i.InvokeUnmarshalled<string[], object, object, Task<object>>(GetSatelliteAssemblies, new[] { "en-GB", "en" }, null, null))
6063
.Returns(Task.FromResult<object>(0))
6164
.Verifiable();
65+
#pragma warning restore CS0618 // Type or member is obsolete
6266

6367
var loader = new WebAssemblyCultureProvider(invoker.Object, CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture);
6468

6569
// Act
6670
await loader.LoadCurrentCultureResourcesAsync();
6771

72+
#pragma warning disable CS0618 // Type or member is obsolete
6873
// Assert
6974
invoker.Verify(i => i.InvokeUnmarshalled<object, object, object, object[]>(ReadSatelliteAssemblies, null, null, null), Times.Never());
75+
#pragma warning restore CS0618 // Type or member is obsolete
7076
}
7177

7278
[Fact]

src/Components/test/testassets/BasicTestApp/InteropComponent.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@
401401

402402
// we should be able to downcast a IJSInProcessObjectReference as a IJSUnmarshalledObjectReference
403403
var unmarshalledCast = (IJSUnmarshalledObjectReference)jsInProcObjectReference;
404+
#pragma warning disable CS0618 // Type or member is obsolete
404405
ReturnValues["jsCastedUnmarshalledObjectReference.unmarshalledFunction"] = unmarshalledCast.InvokeUnmarshalled<InteropStruct, bool>("unmarshalledFunction", new InteropStruct
405406
{
406407
Message = "Sent from .NET",
@@ -418,6 +419,7 @@
418419

419420

420421
var dataReference = unmarshalledRuntime.InvokeUnmarshalled<IJSStreamReference>("jsToDotNetStreamReturnValue");
422+
#pragma warning restore CS0618 // Type or member is obsolete
421423
using var dataReferenceStream = await dataReference.OpenReadStreamAsync();
422424
await ValidateStreamValuesAsync("jsToDotNetStreamReturnValueUnmarshalled", dataReferenceStream);
423425
}

0 commit comments

Comments
 (0)