-
Notifications
You must be signed in to change notification settings - Fork 831
Open
Labels
Milestone
Description
I am using fsharp WASM. Before dotnet10, the development is ok, but after update to dotnet 10. I got the issue "Cannot wait on monitors on this runtime" for below code:
override _.OnInitializedAsync() = task {
for i in 1..3 do
do! Task.Delay 1000
count <- count + i
}Exception detail:
blazor.webassembly.js:1
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Cannot wait on monitors on this runtime.
System.PlatformNotSupportedException: Cannot wait on monitors on this runtime.
at System.Threading.Monitor.ObjWait(:3043/Int32 millisec…Timeout, Object obj)
at System.Threading.Monitor.Wait(:3043/Object obj, In…millisecondsTimeout)
at System.Threading.ManualResetEventSlim.Wait(:3043/Int32 millisec…n cancellationToken)
at System.Threading.Tasks.Task.SpinThenBlockingWait(:3043/Int32 millisec…n cancellationToken)
at System.Threading.Tasks.Task.InternalWaitCore(:3043/Int32 millisec…n cancellationToken)
at System.Threading.Tasks.Task.InternalWait(:3043/Int32 millisec…n cancellationToken)
at Startup.OnInitializedAsync@14.MoveNext((index))
Repro steps
I created a repo to reproduce this: repro
Expected behavior
Should works as before
Known workarounds
I found if I put a do! Task.Yield() in the for loop, then this issue will gone. Because for csharp it works fine, so I think it is related to fsharp task.
Related information
Provide any related information (optional):
- Operating system: Windows11
- .NET Runtime kind: .NET Core
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
New