C#C
C#2y ago
Metalkon

How Do I Add Multithreading In Blazor WebAssembly .NET8?

I'm trying to figure out how to get multithreading to work in my project after seeing posts over a year ago that it was planned for .NET8, but I cannot find much information on how to get it to work. Some things simply don't work period (ex: new Thread(LoopMethod).Start(); from a .NET7 video), others use experimental .net8 stuff from like 2022 (???) in a video, or use some weird third party nuget packages that I cannot figure out and don't seem right anyways.

Anyone have any advice on how to get multithreading to work in my blazor webasm app so I can speed it up (currently takes 10-30sec to run the loop) by running multiple threads at once?

This is what it looks like currently but I don't think "Task.Run(() => LoopMethod());" is the right way, and i'm struggling to figure out how to make it update my stats object through the UpdateStats() method anyways.

https://github.com/Metalkon/Tellarknight-App/blob/home-threads/Tellarknight.Blazor/Pages/Home.razor
image.png
GitHub
An app that's used to easily test your decks consistency - Metalkon/Tellarknight-App
Was this page helpful?