runtime: [browser][mt] Running any Thread for longer than 5000 ms crashes runtime (Blazor)
Description
Spawning any long-running Task or Thread from the main thread for longer than 5000 ms kills application and runtime when using Blazor.
Reproduction Steps
- Create empty Blazor app and use current
mainbuild of runtime in project file - Use Task.Run, Thread.Start or async/await anywhere in the app with a long-running task (importantly, NOT Task.Yield or Task.Delay)
- Observe the error and runtime crash.
Expected behavior
I should be able to start a task from anywhere on the main thread using Task.Run in a Blazor app and not have the runtime crash after 5000ms
Actual behavior
Runtime crashes with error (screenshot above)
Regression?
This previously worked perfectly on the official release build of .NET 8 Preview 4.
Known Workarounds
None
Configuration
No response
Other information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (14 by maintainers)
@lambdageek Of course. It is definitely a compute intensive task in .NET land. No interop is happening inside of it.
@IsaMorphic Can you say a bit more about what’s in the body of the long-running task? Is it compute-intensive? doing a synchronous call to JS that takes longer than 5 seconds? calling some native wasm code (like C code)?
In principle if the long-running task is just a compute loop in C# it should be trying to safepoint at backward branches in the loops… unless we’re failing to emit the safepointing opcodes for some reason…