工作在一个相当大的WPF应用程序,大约有40个模块,并使用Telerik库。
我们已经在这个应用程序上工作了几年,今天,由于某种原因,应用程序开始崩溃
“System.AccessViolationException:'尝试读取或写入受保护的内存'“
这似乎是随机发生的,有时复制网格,打开上下文菜单或移动窗口。
调用堆栈并没有说太多:(此特定堆栈跟踪是在移动窗口时)
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) Unknown
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Unknown
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unknown
PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) Unknown
PresentationFramework.dll!System.Windows.Application.Run() Unknown
Avalon.exe!Avalon.App.Main()第52行C#
崩溃的原因似乎很随机,但总是与UI交互相关。
似乎有什么东西损坏了内存,但是没有非托管代码。
如何调试这样的问题,从哪里开始?
1条答案
按热度按时间e0uiprwp1#
问题似乎是在使用Postsharp
[NotifyPropertyChanged]
复制绑定到UI的对象时引起的并且具有从Prism.MVVM中的
BindableBase
派生的类