使用AvalonDock 2.0时未处理的“ System.ComponentModel.Win32Exception” [英] Unhandled 'System.ComponentModel.Win32Exception' when using AvalonDock 2.0

查看:123
本文介绍了使用AvalonDock 2.0时未处理的“ System.ComponentModel.Win32Exception”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 AvalonDock 2.0 ,并且无论何时,我都在调试模式下打开停靠容器应用程序崩溃(无需调试即可正常运行)。我得到以下异常:

I'm using AvalonDock 2.0, and when ever I open a dock container, while on debugging mode the application crash (it works fine when running without debugging). I get the below exception:


WindowsBase.dll中发生了类型'System.ComponentModel.Win32Exception'
的未处理异常

An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in WindowsBase.dll

其他信息:操作成功完成

Additional information: The operation completed successfully

我遇到了这个答案,建议取消选中例外设置中的复选框。有线的东西是它第一次使用就起作用了。但现在没有了。我在其他计算机上尝试过也无法使用。有关如何解决此问题的任何建议。

Avalon代码(第5行抛出异常)

I came across this answer, which suggest to uncheck the boxes from the Exception Settings. The wired thing is that it worked the first time used it. but it doesn't any more. I've tried on other machines it doesn't work either. any suggestions to how to fix this.
Avalon code(exception thrown at line 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);
        }


推荐答案

显然有一个问题已提交,但直到现在都没有任何反应。

Apparently there's an issue is filed, but with no response till this moment.

因此,作为一种解决方法,我已经使用来自 App.xaml.cs 的Application.DispatcherUnhandledException

请检查此答案以获取更多详细信息。

代码:

So as a workaround I have handled any unhandled exceptions using Application.DispatcherUnhandledException from App.xaml.cs.
Please check this answer for more details.
Code:

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;
}

这篇关于使用AvalonDock 2.0时未处理的“ System.ComponentModel.Win32Exception”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆