我们的产品使用 mono 4.8.0。在不同类型的 Linux 上运行特定测试时,我们偶尔会触发未处理的异常。更具体地说,AppDomain.UnhandledException 事件被触发。但是我们无法弄清楚是哪一行代码触发了异常。我想知道这是单声道的缺陷吗?
[ERROR] FATAL UNHANDLED EXCEPTION: System.ExecutionEngineException: ExecutionContext_ExceptionInAsyncLocalNotification ---> System.Threading.ThreadAbortException at System.Collections.Generic.ObjectEqualityComparer'1[T].Equals (T x, T y) <0x7f0f20aa1e80 + 0x00000> in :0 at System.Collections.Generic.Dictionary'2[TKey,TValue].FindEntry (TKey key) [0x0005d] in :0 at System.Collections.Generic.Dictionary'2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x00000] in :0 at System.Threading.ExecutionContext.OnAsyncLocalContextChanged (System.Threading.ExecutionContext previous, System.Threading.ExecutionContext current) [0x00119] in ...../mono/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:749 --- End of inner exception stack trace --- at System.Environment.FailFast (System.String message, System.Exception exception) [0x00000] in ...../mono/mono/mcs/class/corlib/System/Environment.cs:929 at System.Threading.ExecutionContext.OnAsyncLocalContextChanged (System.Threading.ExecutionContext previous, System.Threading.ExecutionContext current) [0x00164] in ..../mono/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:758 at System.Threading.ExecutionContext.SetExecutionContext (System.Threading.ExecutionContext executionContext, System.Boolean preserveSyncCtx) [0x0005f] in ..../mono/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:1028
谢谢
最佳答案
尝试 <AppContextSwitchOverrides value="Switch.System.Globalization.NoAsyncCurrentCulture=true" />
并避免使用 AsyncLocal<T>
关于c# - 来自单声道的奇怪的未处理异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49757479/