我正在使用一个奇怪的NullReferenceException,它显然是从ItemAutomationPeer类的GetNameCore()函数触发的.
下面的例外细节如下,但真正有趣的方面是它不会出现在运行Windows 7的开发机器或我们测试过的其他Windows 7计算机上.它只发生在我的Windows 8 Pro测试机上.
尝试编辑WPF DataGrid控件中的单元格时,显然会抛出异常.
我一直试图追踪它整天没有成功.我尝试使用Visual Studio远程调试进程并单步执行代码,但是没有任何用户代码似乎触发异常.它显然是由PresentationFramework.Dll内部的一系列事件执行的,异常只是通过AppDomain冒泡并最终导致应用程序崩溃.
如果任何人可以想到任何可能导致这种情况的事情,或者某种方法来解决它,那将非常有帮助.
Exception Type: System.NullReferenceException
Exception Message: Object reference not set to an instance of an object.
Method Information: System.String GetNameCore()
Exception Source: PresentationFramework
Stack Trace
at System.Windows.Automation.Peers.ItemAutomationPeer.GetNameCore()
at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
at System.Windows.ContextLayoutManager.fireAutomationEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, …Run Code Online (Sandbox Code Playgroud)