c# – 使用AvalonDock 2.0时未处理的’System.ComponentModel.Wi
发布时间:2020-12-15 07:54:35 所属栏目:百科 来源:网络整理
导读:我正在使用 AvalonDock 2.0,当我打开一个dock容器时,在调试模式下应用程序崩溃(它在没有调试的情况下运行时工作正常).我得到以下异常: An unhandled exception of type ‘System.ComponentModel.Win32Exception’ occurred in WindowsBase.dll Additional i
我正在使用
AvalonDock 2.0,当我打开一个dock容器时,在调试模式下应用程序崩溃(它在没有调试的情况下运行时工作正常).我得到以下异常:
我遇到了这个answer,建议取消选中Exception Settings中的方框.有线的事情是它第一次使用它.但它不再存在了.我试过其他机器也不行.任何有关如何解决此问题的建议. 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处理了任何未处理的异常. 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; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |