Closed devshgraphicsprogramming closed 2 years ago
@devshgraphicsprogramming thanks for contacting us.
This is a dupe of https://github.com/dotnet/aspnetcore/issues/17730
@devshgraphicsprogramming thanks for contacting us.
This is a dupe of #17730
I didn't get answers to any of my questions.
Nowadays .NET runs in either Webassembly or native with blazor projects (E.G Blazor Webassembly vs Maui.Blazor)
The awesome firefox cartoon girl Lin Clark
said there is a wasm land and JS land, if you are calling .NET codes running in webassembly it might work especially if a worker thread can access resources in other threads / worker I guess.
I am more confident that it would work if .NET is running without Webassembly, I have never tried it though
Nowadays .NET runs in either Webassembly or native with blazor projects (E.G Blazor Webassembly vs Maui.Blazor)
The awesome firefox cartoon girl
Lin Clark
said there is a wasm land and JS land, if you are calling .NET codes running in webassembly it might work especially if a worker thread can access resources in other threads / worker I guess.I am more confident that it would work if .NET is running without Webassembly, I have never tried it though
How do you mean native when MAUI Blazor just uses Javascript?
<script src="_framework/blazor.webview.js"></script>
There was a native Blazor project called Blazor Mobile Bindings which was scrapped. That project focused on binding native (platform specific) controls to Blazor syntax. Before Blazor was added to MAUI, it was called Blazor Desktop. Today it is called Blazor Hybrid which causes confusion with the project "Blazor Mobile Bindings".
Dotnet rt doesn't run inside Maui.Blazor's webview I found out, all your c# code is running with regular multi-threading scenario's support, when you update the virtual dom it talks to the webview and the webview updates the UI.
There is no way they just let dotnet run inside the browser via javascript anymore, it used to be ASM.js, then webassembly was a better choice for any compiled code
Blazor Mobile binding was an experimental project that let you write Xamarin app with blazor syntax which I love, because it's very painful for me to write Xaml app due to these products always assume there is a pattern you are following and really made it hard for me to do my own stuffs.
Blazor hybrid was the step further, since Eilon Lipton
implemented mixing syntax, the scenario where you had the application mixing UI from both syntax was explored. I was very amazed by this because you can actually write web UI when you want and you can write native UI when browser lacks something you want, yet it also meant I can use multiple-threads now because the guy made it work so that there is no webassembly / javascript / server running dotnet rt.
Today's Maui.blazor is basically a re-branded name with a lot effort put into the project (before release bugs were issued and sometimes it's severe and it was resolved in preview).
Blazor Desktop was before MAUI, they made the guy's project offifical, before it was experimental. That was in .NET 6, in .NET 7 they got it a new name based on Hawaii.
Summary
Since
SharedByteArray
is again available on browsers (provided you do all the CORS header stuff properly as required by site isolation), this renders the following comment https://github.com/dotnet/aspnetcore/issues/16954#issuecomment-552226873 obsolete.Also AFAIK, WebWorker post-message (exposed as a C API in emscripten) does not need SBA to work, but yes, without SBA attempting to work on the same memory will straight up not work.
Anyway, realizing that Blazor wont catch up on SBA availability immediately, I've had an idea (assuming #56145 doesn't prevent me) to use a small C++ lib to facilitate launching or additional threads or web workers executing C# code.
Now the question is, will that break the runtime?
Motivation and goals
Achieve threading or parallelism while still running C# and not C++
In scope
new
ing C# objects in multiple threads which won't share objectsOut of scope
Risks / unknowns
Bonus Round
Is it possible to make the Blazor runtime back its GC arena/memory-pool with
WebAssembly.Memory(,,shared:true)
?Related
14253