程序和调试器退出而没有指示问题

时间:2010-12-26 01:47:38

标签: c# .net visual-studio debugging heisenbug

好吧,不是Heisenbug,但性质相似。

我正在开发一个WPF应用程序。调试时,逻辑到达某一点,然后应用程序无缘无故退出。 VS调试器没有捕获任何内容,输出窗口中出现以下问题:

  

程序'[6228] SomeApp.vshost.exe:Managed(v4.0.30319)'已退出,代码为1073741855(0x4000001f)。

在调试发行版本时,或者确实从调试器运行调试版本时(实际上所有没有在调试器中运行调试版本的组合),一切正常。

我正在尝试使用以下代码捕获未处理的异常:

        AppDomain
            .CurrentDomain
            .UnhandledException +=
            (sender, e) =>
            {
                Debug.WriteLine("Unhandled Exception " + e.ExceptionObject);
            };
        Application
            .Current
            .DispatcherUnhandledException +=
            (sender1, e1) =>
            {
                Debug.WriteLine("DispatcherUnhandledException " + e1.Exception);
            };

......但我没有抓到任何东西。

我正在考虑使用调试输出语句来处理应用程序,但它是高度异步的,因此阅读这将是艰巨而乏味的。

告诉我,如果你能......我怎么开始计算WTF正在进行?

6 个答案:

答案 0 :(得分:33)

根据ntstatus.h文件,0x4000001f(STATUS_WX86_BREAKPOINT)是Win32 x86仿真子系统使用的异常状态代码。它(我想)意味着你达到了一个不可利用的断点。您应该启用调试非托管代码。

答案 1 :(得分:13)

使用Visual Studio 2012(版本11.0.50727.1 RTMREL),我找到的唯一解决方案是转到Project - >属性 - >调试并关闭“启用Visual Studio托管过程”。

“启用本机代码调试”选项没有帮助,即使我将所有异常设置为break-when-thrown。

有趣的是,当我从VS2012 beta升级到VS2012官方版本时,这个问题才开始发生。

答案 2 :(得分:6)

我与Visual Studio 2013具有相同的情况。 像罗恩这样拯救我的一天: 项目 - >属性 - >调试并关闭“启用Visual Studio托管过程”。

由于

答案 3 :(得分:1)

重新启动为我解决了问题。

我遇到了尝试通过Resharper的测试运行程序通过NUnit进行调试的问题,并单独尝试单步执行W3WP.exe进程。

答案 4 :(得分:0)

我遇到了同样的问题。在我的情况下,我注意到我有一个吸气和安装者的财产。我的错误是返回属性本身而不是链接到它的属性,这迫使调试器进入无限循环,在修复之后,问题解决了。我得到了相同的错误代码,没有其他信息 -

答案 5 :(得分:0)

I was getting the same behavior with FonstSize="auto" (not sure why):

<TextBlock Text="{Binding DisplayText}" FontSize="auto"/>

Fix:<TextBlock Text="{Binding DisplayText}" />

Additional Error Output:

LS stop assert - tserrInternalError, file f:\dd\wpf\src\native\ums\shared\inci\tsoverflow.h, line 66

An unhandled exception of type 'System.Exception' occurred in PresentationCore.dll Additional information: Vom Textformatierungsmodul kann aufgrund des folgenden Fehlers keine Textzeile formatiert werden: "LsInternalError".