我在用着阿瓦隆码头2.0,当我打开一个停靠容器时,在调试模式下应用程序崩溃(在没有调试的情况下运行时它工作正常)。我得到以下异常:
“System.ComponentModel.Win32Exception”类型的未处理异常
发生在WindowsBase.dll中
附加信息:操作成功完成
我遇到了这个answer,建议取消选中“例外设置”中的复选框。有线的事情是它第一次使用它就有效。但它不再是了。我在其他机器上也试过,也不行。有关如何解决此问题的任何建议。
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);
}
显然有一个issue已提交,但截至目前尚未回复。
因此,作为解决方法,我使用以下方法处理了任何未处理的异常Application.DispatcherUnhandledException from App.xaml.cs
.
请检查这个answer更多细节。
代码:
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;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)