Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WASM] Multithreading with .Net8 doesn't work because Uno.WASM.MetadataUpdate is compiled with .net7? #780

Closed
Rippletank opened this issue Oct 7, 2023 · 4 comments · Fixed by #789

Comments

@Rippletank
Copy link

Rippletank commented Oct 7, 2023

UnoWASMnet80Threading.zip

Current behavior

A simple .net8.0, WASM only solution created using the latest template (according to uno-check) with all of the uno and Microsoft packages updated to latest dev/rc releases.

With no multithreading, the app starts ok.

With threading enabled using
<WasmShellEnableThreads>true</WasmShellEnableThreads>
startup aborts at line 359 of uno-bootstrap.js
await this.setupHotReload()

The error appears to be at line 63:
let exports = await getAssemblyExports("Uno.Wasm.MetadataUpdater");
with error, "Could not load content for file:///D:/a/Uno.DotnetRuntime.WebAssembly/Uno.DotnetRuntime.WebAssembly/runtime/src/mono/wasm/runtime/invoke-cs.ts (System error: net::ERR_FILE_NOT_FOUND)"

Expected behavior

Expected behaviour is for the threaded version to load fully as with the unthreaded version.

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

No response

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

	<PackageReference Include="Uno.Resizetizer" Version="1.2.0-dev.68" />
	<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.0-rc.1.23420.5" />
	<PackageReference Include="Uno.Wasm.Bootstrap" Version="8.0.0-dev.291" />
	<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.0-dev.291" />
	<PackageReference Include="Uno.WinUI.WebAssembly" Version="5.0.0-dev.3369" />
	<PackageReference Include="Uno.WinUI.RemoteControl" Version="5.0.0-dev.3369" Condition="'$(Configuration)'=='Debug'" />
	<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.0-dev.3369" />
	<PackageReference Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.7.0-dev.1" />
	<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-rc.1.23419.4" />

Affected platforms

WebAssembly

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@Rippletank Rippletank changed the title Enabling multithreading with .Net8 causes abort during setupHotReload() [WASM] Enabling multithreading with .Net8 causes abort during setupHotReload() Oct 8, 2023
@Rippletank
Copy link
Author

Ok, after looking again with fresh eyes and getting hold of the typescript files, I have found the error.

"JSExport with multi-threading enabled is not supported with assembly ${assembly} as it was generated with the .NET 7 SDK" for assembly = Uno.WASM.MetadataUpdate

As I am digging into the unknown (for me), I'm putting this here as it seems like it might make sense to someone more knowledgeable. Meanwhile, I can't immediately see where this assembly is coming from so I will keep digging.

@Rippletank Rippletank changed the title [WASM] Enabling multithreading with .Net8 causes abort during setupHotReload() [WASM] Multithreading with .Net8 doesn't work because Uno.WASM.MetadataUpdate is compiled with .net7? Oct 9, 2023
@Rippletank
Copy link
Author

Workaround: Unsuccessfully, tried to find a way to disable hot-reload before the app is loaded in debug mode, but Release mode works properly without an error.

@jeromelaban jeromelaban transferred this issue from unoplatform/uno Oct 10, 2023
@jeromelaban
Copy link
Member

Thanks for the report.

We'll likely need to build this project with net8 instead.

@Rippletank
Copy link
Author

Thanks, can confirm the using latest builds (dev.3455) app now runs fully in debug mode with threading.

However, just for information, when multithreading is enabled, breakpoints are not hit and the browser window is disconnected from the server. The only difference in terms of console messages is the following error in multithreaded mode:

Unable to set option 'no-jiterpreter-traces-enabled' as it's read-only. dotnet.native.js

I'm guessing that's a dotnet issue, though. Work arounds are just console debugging or switching off multithreading temporarily, but at least with shorter compile times of debug mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants