uno icon indicating copy to clipboard operation
uno copied to clipboard

[Wasm] Support running under WSL from Visual Studio

Open iosub opened this issue 4 years ago • 2 comments

Current behavior

Running WASM Setting Running on WSL Error 'ECall methods must be packaged into a system module.'

I get the error on; Windows.UI.Xaml.Application.Start(_ => _app = new App()); Stack Exception thrown: 'System.Security.SecurityException' in Uno.Foundation.Runtime.WebAssembly.dll An unhandled exception of type 'System.Security.SecurityException' occurred in Uno.Foundation.Runtime.WebAssembly.dll: 'ECall methods must be packaged into a system module.' Stack trace:

at WebAssembly.Runtime.NetCoreInvokeJS(String str, Int32& exceptionResult) at WebAssembly.Runtime.InvokeJS(String str) at Uno.Foundation.WebAssemblyRuntime.InnerInvokeJS(String str) at Uno.Foundation.WebAssemblyRuntime.InvokeJS(String str) at Uno.UI.Xaml.WindowManagerInterop.Init(Boolean isHostedMode, Boolean isLoadEventsEnabled) at Windows.UI.Xaml.Application.StartPartial(ApplicationInitializationCallback callback) at Windows.UI.Xaml.Application.Start(ApplicationInitializationCallback callback) at MySaaSPlace.Wasm.Program.Main(String[] args) in C:\msp\2018\Dev\Dev\Lite.Uno\branch\3.10\MySaaSPlace\MySaaSPlace.Wasm\Program.cs:line 40

Expected behavior

No response

How to reproduce it (as minimally and precisely as possible)

launchSettings.json

"WSL": { "commandName": "WSL2", "launchBrowser": true, "launchUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_URLS": "http://localhost:5000" }, "distributionName": "" }

Workaround

No response

Works on UWP/WinUI

No response

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia

NuGet package version(s)

Uno.UI.WebAssembly" Version="3.11.0-dev.341 Uno.Wasm.Bootstrap" Version="3.0.0" Uno.Wasm.Bootstrap.DevServer" Version="3.0.0"

Affected platforms

WebAssembly

IDE

No response

IDE version

VS 2019 and VS2022 Preview 4

Relevant plugins

No response

Anything else we need to know?

No response

iosub avatar Oct 07 '21 00:10 iosub

Thanks for the report. This is likely a visual studio issue for which we may not have control over.

In this case, this means that the executable is started by the .NET desktop runtime, making webassembly-specific calls fail.

jeromelaban avatar Oct 07 '21 12:10 jeromelaban

I know the issue is a year old but the same happens on MacOS (with Rider) on the WASM-head. dotnet run works perfectly.

linkdotnet avatar Aug 07 '22 14:08 linkdotnet