-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Issues using Blazor Multithreading within iframes #86696
Comments
Hey there again everyone, I managed to isolate the issue after figuring out that I can use an OS-wide environment variable to append whatever arguments I want to all calls to Here's a link to the problematic method for anyone curious: runtime/src/mono/wasm/runtime/strings.ts Line 74 in da30389
Thanks, |
…ffer from different JavaScript realm When performing tasks such as allocating or marshalling large amounts of memory in multithreaded .NET land, inconsistent and frequent crashing behavior is exhibited. Related issues: emscripten-core/emscripten#15217 https://github.com/dotnet/aspnetcore/issues/48390
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsIs there an existing issue for this?
Describe the bugUsing the wasm-buildtools for .NET 8.0 Preview 4, I have come across an unpredictable and frequent runtime bug when embedding a multithreaded Blazor application within an iframe on another page. I've double checked that all CSP and CORS policies are in order and not the root cause. In fact, I found someone else reporting this exact same issue, only in a completely different use case over by the emscripten repository: emscripten-core/emscripten#18034 The workaround being tossed out there by several developers is to make sure that all calls to I've been able to greatly reduce the frequency of this error by adding this flag using these properties: I have also confirmed that these flags are being used to compile my assemblies and dependencies. However, I can't figure out a way to add this flag to the main dotnet.wasm emcc command to ensure that my dotnet-runtime.js file does not use Interesting to note is that the frequency of this error greatly decreases when embedding the blazor application page with Regardless, the error I am receiving exhibits the same, inconsistent behavior. I'm guessing this is a Blazor toolchain issue that can be fixed by making sure that the Expected BehaviorThe expected behavior is that I can use my multithreaded Blazor WebAssembly application within an Steps To ReproduceNo response Exceptions (if any)
.NET Version8.0.100-preview.4.23260.5 Anything else?No response
|
cc @pavelsavara |
Is there an existing issue for this?
Describe the bug
Using the wasm-buildtools for .NET 8.0 Preview 4, I have come across an unpredictable and frequent runtime bug when embedding a multithreaded Blazor application within an iframe on another page. I've double checked that all CSP and CORS policies are in order and not the root cause.
In fact, I found someone else reporting this exact same issue, only in a completely different use case over by the emscripten repository: emscripten-core/emscripten#18034
The workaround being tossed out there by several developers is to make sure that all calls to
emcc
use the flag-s TEXTDECODER=0
I've been able to greatly reduce the frequency of this error by adding this flag using these properties:
<EmccCompileOptimizationFlag>-O2 -s TEXTDECODER=0</EmccCompileOptimizationFlag>
<EmccLinkOptimizationFlag>-O2 -s TEXTDECODER=0</EmccLinkOptimizationFlag>
to my csproj file.
I have also confirmed that these flags are being used to compile my assemblies and dependencies. However, I can't figure out a way to add this flag to the main dotnet.wasm emcc command to ensure that my dotnet-runtime.js file does not use
TextDecoder
to marshal WASM memory across threads.Interesting to note is that the frequency of this error greatly decreases when embedding the blazor application page with
object
tags instead ofiframe
.Regardless, the error I am receiving exhibits the same, inconsistent behavior. I'm guessing this is a Blazor toolchain issue that can be fixed by making sure that the
-s TEXTDECODER=0
flag is used when compiling dotnet-runtime.js at publish-time; to safeguard against any regressions of users this bug doesn't affect, this flag would only be added ifWasmEnableThreads
is also explicitly enabled. I'm willing to write a PR that implements this.Expected Behavior
The expected behavior is that I can use my multithreaded Blazor WebAssembly application within an
iframe
without the previously described inconsistent crashing behavior.Steps To Reproduce
No response
Exceptions (if any)
Uncaught TypeError: Failed to execute 'decode' on 'TextDecoder': The provided ArrayBufferView value must not be shared.
.NET Version
8.0.100-preview.4.23260.5
Anything else?
No response
The text was updated successfully, but these errors were encountered: