Closed ekral closed 3 years ago
Hi. It looks like this is a question about how to use ASP.NET Core. While we do our best to look through all the issues filed here, we are not a general-purpose forum. To get a faster response we suggest posting your questions to StackOverflow using the blazor tag.
Thank you @mkArtakMSFT, I appretiate your time. I think it may be connected to this issue: https://github.com/dotnet/runtime/issues/43411 because Roslyn does use Parallel.For inside GetDiagnostics.
I still think it may be a bug. But as a temporal fix, I can set concurrentBuild option on CSharpCompilationOptions to false.
Describe the bug
Blazor wasm application:
When a user invokes the event handler method as the first method in the application, and this method calls CSharpCompilation.GetDiagnostics(CancellationToken) method, GetDiagnostics method throws System.PlatformNotSupportedException: Cannot wait on monitors on this runtime.
When a user invokes the event handler method as the second method in the application, and this method calls CSharpCompilation.GetDiagnostics(CancellationToken) method, there is no exception.
To Reproduce
Use case 1:
result: System.PlatformNotSupportedException: Cannot wait on monitors on this runtime.
Use case 2:
result: works as expected, writes "(1,5): warning CS0219: The variable 'x' is assigned but its value is never used" on console
Repository
Exceptions
Further technical details
dotnet --info