【发布时间】:2020-08-13 14:41:45
【问题描述】:
我目前正在开发一个 .NET Standard 2.1 Blazor WebAssembly 托管应用程序。
我的应用程序结构如下所示:
- BlazorApp.Client(此处发生错误)
- BlazorApp.Server
我在我的 BlazorApp.Client 项目中使用 Serilog 和 Elasticsearch 接收器。它工作正常,但是当我在 Serilog 上启用 Selflog 并进行调试时,我在浏览器控制台中收到以下错误:
SelfLog.Enable(msg => Debug.WriteLine(msg));
Elasticsearch.Net.UnexpectedElasticsearchClientException:无法等待此运行时的监视器。 ---> System.Threading.SynchronizationLockException: 无法在此运行时等待监视器。
at (wrapper managed-to-native) System.Threading.Monitor.Monitor_wait(object,int)
在 System.Threading.Monitor.ObjWait (System.Boolean exitContext, System.Int32 毫秒超时, System.Object obj) in :0
在 System.Threading.Monitor.Wait (System.Object obj, System.Int32 millisecondsTimeout, System.Boolean exitContext) in :0
这似乎是当前 Blazor WASm 版本中的一个问题:https://github.com/dotnet/aspnetcore/issues/22400
Cannot Wait on monitors 有谁知道,如何在 Blazor WebAssembly 客户端中消除此错误?
【问题讨论】:
-
我认为目前WASM上的MONO运行时只支持单线程。
标签: c# multithreading blazor webassembly .net-standard-2.1