Program and debugger quit without indication of problem

Posted by spender on Stack Overflow See other posts from Stack Overflow or by spender
Published on 2010-12-26T01:47:37Z Indexed on 2010/12/26 1:54 UTC
Read the original article Hit count: 623

Filed under:
|
|
|
|

OK, not quite a Heisenbug but similar in nature.

I'm developing a WPF application. When debugging, the logic reaches a certain point, then the application quits for no reason. VS debugger catches nothing and the only indication of a problem is the following in the output window:

The program '[6228] SomeApp.vshost.exe: Managed (v4.0.30319)' has exited with code 1073741855 (0x4000001f).

When debugging the release version, or indeed running the debug build out of the debugger (in fact all combos that aren't running the debug version in debugger), everything works fine.

I'm trying to catch unhandled exceptions with the following code:

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

...but I'm not catching anything.

I'm considering peppering the app with debug output statements, but it's highly asynchronous so reading this will be both arduous and tedious.

So tell me, if you can... how do I start figuring WTF is going on?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET