Uno.Samples
Uno.Samples copied to clipboard
Error running CameraCaptureUISample.Wasm Unhandled Exception: System.Security.SecurityException: ECall methods must be packaged into a system module.
Hi I did a fork of the samples I want to run the camera on wasm but when I try to do it I got the following exception
Unhandled Exception: System.Security.SecurityException: ECall methods must be packaged into a system module. 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 CameraCaptureUISample.Wasm.Program.Main(String[] args) in C:\Users\Joche\Source\Repos\Uno.Samples\UI\CameraCaptureUI\CameraCaptureUISample\CameraCaptureUISample.Wasm\Program.cs:line 12
C:\Users\Joche\Source\Repos\Uno.Samples\UI\CameraCaptureUI\CameraCaptureUISample\CameraCaptureUISample.Wasm\bin\Debug\netstandard2.0\CameraCaptureUISample.Wasm.dll (process 7276) exited with code -532462766. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . .
Thanks for the report! This error generally means that the bootstrapper is not installed properly, and needs to be adjusted.
This being said, this sample is not supported on WebAssembly yet, you'll probably notice that the method calls to the camera capture APIs are marked as not implemented in the code.
If this is an API that you'd like to have support for, please open an issue here: https://github.com/unoplatform/uno/issues/new/choose
GitHub
GitHub is where people build software. More than 50 million people use GitHub to discover, fork, and contribute to over 100 million projects.
I've also gotten this error when I've accidentally set my WASM project as the startup project, which tries to run it as a console app. Just FYI for anyone else who makes this mistake and comes across this.
@SerratedSharp Using the Wasm project as startup is expected to work, but if you're using VS 2022 17.6 Preview 1, you may encounter this issue. Is that the case?
Hey Jerome, Using 17.4.3. I'm not using the dev server in the WASM project, so I assume that's why it's different than expected. It gets built and then served from a separately hosted project. I'm only using Uno.Foundation.Runtime.WebAssembly and Uno.Wasm.Bootstrap. I can clarify my comment if that's as expected.
Thanks. Why are you not using the devserver package? This is what makes the debugging experience work in Visual Studio.
@jeromelaban I use a MVC/WebAPI project as the web host and serve the WASM package as static files from that, analogous to how I'd load any other client side static resources like js/css. That way I can use a traditional approach for the server side logic and page templates, and WASM for client side behavior. I suppose in retrospect I could have just hosted two separate self hosted sites to accomplish the same, and reference the WASM host URL from the former. This is just what I arrived at after alot of fiddling at a time I didn't fully understand all the plumbing.
@SerratedSharp makes sense, thanks. If you are using our latest templates, are you using the .Server
project from our latest templates or is there some missing structure ?