开发者

Can't get debugging to work: .NET 4.0, Windows 2003 server

I have a .NET 4.0 console application running on a production server. The app is 开发者_运维百科run on an ad-hoc basis, is compiled as a debug build and all debug symbols are sent up to the server with the exe.

When an exception is raised in the app, I expect that it will die ungracefully and print the stack to the console like any old console app should. Instead, the behavior I see is this:

  1. The JIT debugger window appears, asking to debug.
  2. If I say "yes", it fires up some extremely limited version of VS 2005. I'm dumped into assembly language and cannot see the source code or the name of the file. This is the case for all levels of the stack trace.
  3. If I say "no", no information is written to the console at all.

I've tried running this in both a powershell shell and a traditional cmd console with the same effect.

The server runs ASP.NET 4.0 and has no trouble returning those errors to the browser.

What I desire is to simply see the true error and the stack printed to the console without the JIT popping up. Aside from a global catch and write, what are my options?


using System;

class Program {
    static void Main(string[] args) {
        AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        throw new Exception("test");
    }

    static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
        Console.WriteLine(e.ExceptionObject.ToString());
        Console.ReadLine();
        Environment.Exit(1);
    }
}


Your best option is to use Windbg to debug and analyze the application: http://www.microsoft.com/whdc/devtools/debugging/default.mspx

You can use SOSEX extension for managed debugging in Windbg: http://www.stevestechspot.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜