我正在使用
AvalonDock 2.0,当我打开一个dock容器时,在调试模式下应用程序崩溃(它在没有调试的情况下运行时工作正常).我得到以下异常:
An unhandled exception of type ‘System.ComponentModel.Win32Exception’
occurred in WindowsBase.dllAdditional information: The operation completed successfully
我遇到了这个answer,建议取消选中Exception Settings中的方框.有线的事情是它第一次使用它.但它不再存在了.我试过其他机器也不行.任何有关如何解决此问题的建议.
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,Win32Helper.SetwindowPosFlags.IgnoreMove | Win32Helper.SetwindowPosFlags.IgnoreResize); } } return base.WndProc(hwnd,msg,wParam,lParam,ref handled); }
解决方法
显然有一个
issue提交,但直到现在没有回应.
因此,作为一种解决方法,我使用App.xaml.cs中的Application.DispatcherUnhandledException处理了任何未处理的异常.
有关详细信息,请查看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; }
原文地址:https://www.jb51.cc/csharp/99908.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。