我的应用程序的某些用户在System.Runtime.CompilerServices.AsyncServices中遇到来自不同异常的奇怪崩溃
堆栈跟踪中没有我的代码,我也不知道在哪里搜索原因或如何添加其他日志记录以查找崩溃的原因。 谷歌搜索没有帮助。
例外的例子是:
String reference not set to an instance of a String. Parameter name: s Void System.Runtime.CompilerServices.AsyncServices.b__0(System.Object) System.Object System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) System.Object MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) Void System.Windows.Threading.DispatcherOperation.InvokeImpl() Void System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) Void System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) Void System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) Void System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) Void System.Windows.Threading.DispatcherOperation.Invoke() Void System.Windows.Threading.Dispatcher.ProcessQueue() IntPtr System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) IntPtr MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) System.Object MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) System.Object System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) System.Object MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) System.Object System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) IntPtr MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) IntPtr MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) Void System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) Void System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) Void System.Windows.Threading.Dispatcher.Run() System.Object System.Windows.Application.RunDispatcher(System.Object) Int32 System.Windows.Application.RunInternal(System.Windows.Window) Int32 System.Windows.Application.Run(System.Windows.Window) Int32 System.Windows.Application.Run() App.g.cs - Void MyProject.App.Main()
Object reference not set to an instance of an object. Void System.Runtime.CompilerServices.AsyncServices.b__0(System.Object) System.Object System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) System.Object MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) Void System.Windows.Threading.DispatcherOperation.InvokeImpl() Void System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) Void System.Threading.ExecutionContext.runTryCode(System.Object) Void System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object) Void System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) Void System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) Void System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) System.Object System.Windows.Threading.DispatcherOperation.Invoke() Void System.Windows.Threading.Dispatcher.ProcessQueue() IntPtr System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) IntPtr MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) System.Object MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) System.Object System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) System.Object MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) System.Object System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) IntPtr MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) IntPtr MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) Void System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) Void System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) System.Object System.Windows.Application.RunDispatcher(System.Object) Int32 System.Windows.Application.RunInternal(System.Windows.Window) Int32 System.Windows.Application.Run(System.Windows.Window) Int32 System.Windows.Application.Run() App.g.cs - Void MyProject.App.Main()
其他信息: 我的目标是使用.NET 4.0并使用Microsoft.Bcl.Async。 上面描述的第一个例外发生在使用Win 7 / NET 4.0的机器上
更新:我会尝试澄清这个问题。
如果在异步方法中发生某些异常,似乎会出现这些堆栈跟踪。 有没有办法找到发生原始异常的地方?因为在不知道除了异常消息之外的任何事情的情况下调试这些问题非常困难。
答案 0 :(得分:4)
由于似乎没有人知道更好的解决方案,我会发布我使用的那个。
我发现引起其中一次崩溃的原始异常总是首先触发FirstChanceException事件。
因此要知道异常的原因是什么,我做了以下事情: