IBR*_*BRA 7 c# wpf exception win32exception avalondock
我正在使用AvalonDock 2.0,当我打开一个dock容器时,在调试模式下应用程序崩溃(它在没有调试的情况下运行时工作正常).我得到以下异常:
WindowsBase.dll中发生了未处理的"System.ComponentModel.Win32Exception"类型异常
附加信息:操作成功完成
我遇到了这个答案,建议取消选中"例外设置"中的框.有线的事情是它第一次使用它.但它不再存在了.我试过其他机器也不行.任何有关如何解决此问题的建议.
Avalon代码(第5行引发的异常)
protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
if (msg == Win32Helper.WM_WINDOWPOSCHANGING) {
if (_internalHost_ContentRendered) {
// the below line throw the exception
Win32Helper.SetWindowPos(_internalHwndSource.Handle, Win32Helper.HWND_TOP, 0, 0, 0, 0, Win32Helper.SetWindowPosFlags.IgnoreMove | Win32Helper.SetWindowPosFlags.IgnoreResize);
}
}
return base.WndProc(hwnd, msg, wParam, lParam, ref handled);
}
Run Code Online (Sandbox Code Playgroud)
显然有一个问题已提交,但到目前为止尚未得到回复。
因此,作为解决方法,我使用来自 的Application.DispatcherUnhandledExceptionApp.xaml.cs
处理了任何未处理的异常。
请检查此答案以获取更多详细信息。
代码:
protected override void OnStartup(StartupEventArgs e) {
base.OnStartup(e);
this.DispatcherUnhandledException += AppGlobalDispatcherUnhandledException;
}
private void AppGlobalDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) {
e.Handled = true;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3376 次 |
最近记录: |