Tôi đang chiến đấu với một NullReferenceException lạ mà dường như được kích hoạt từ hàm GetNameCore() của lớp ItemAutomationPeer.NullReferenceException từ PresentationFramework.dll
Chi tiết ngoại lệ bên dưới nhưng khía cạnh hấp dẫn thực sự là nó không xảy ra trên máy phát triển của tôi chạy Windows 7 hoặc các máy tính Windows 7 khác mà chúng tôi đã thử nghiệm. Nó chỉ xảy ra trên máy tính thử nghiệm Windows 8 Pro của tôi.
Ngoại lệ được ném rõ ràng khi cố chỉnh sửa ô trong điều khiển DataGrid WPF.
Tôi đã cố gắng theo dõi nó cả ngày mà không thành công. Tôi đã thử gỡ lỗi quá trình từ xa bằng cách sử dụng Visual Studio và bước qua mã nhưng không ai trong số mã người dùng dường như được kích hoạt ngoại lệ. Nó rõ ràng là được thực hiện bởi một chuỗi các sự kiện bên trong PresentationFramework.Dll và ngoại lệ chỉ phát tán thông qua AppDomain và cuối cùng là treo ứng dụng.
Nếu có ai có thể nghĩ ra bất cứ điều gì có thể gây ra điều này, hoặc một cách để khắc phục nó, nó sẽ thực sự hữu ích.
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, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
khi bạn nói điều này xảy ra trên Windows 8 máy tính thử nghiệm, là ứng dụng được xây dựng trên cùng một máy hoặc trên một Windows-8 máy? hoặc nó được xây dựng trên W7 và chỉ được thực thi từ Windows-8?Hãy nghĩ rằng có khá một vài trận đấu sai giữa dll giữa 2 hệ điều hành và cần một số tài liệu tham khảo để được sao chép tại địa phương cho nó hoạt động trên Windows-8 khi được xây dựng từ một máy W7. Hãy thử xây dựng nó từ Windows-8 và xem nếu vấn đề vẫn còn tồn tại. Bạn có thể thấy một lỗi biên dịch hoặc lấy một số chi tiết bên trongException khi thực hiện để có thể chỉ ra dll nào gây ra sự không khớp (Cái gì giống như Aero với Aero2 và vân vân) – Viv
đó là một ý tưởng thú vị. Tôi không có một máy Windows 8 với VS vì vậy tôi không thể kiểm tra giả thuyết đó ngay bây giờ .. tuy nhiên, bạn có thể được vào một cái gì đó liên quan đến khuôn khổ là hơi khác nhau. –