Reputation: 2910
I have a .NET Windows application in the production that has no access to Visual Studio (standard edition), and the only thing they can install is the Express edition, which does not have the Just-In-Time Debugging option (the one which has the debug button when it crashes). So I was just wondering if there is a Windows application debugging tool or something else that I can run or attach to see stacktraces. I also enabled PDB in my application, but it does not provide any more information, so I can trace my crashes (caused by unhandled exceptions).
Upvotes: 4
Views: 9950
Reputation: 17604
The stacktraces of .NET application exceptions are logged in your Event Viewer under Applications.
This link throws a 404:
alt text http://eduncan911.com/blog/thumbnail/exception-in-iis-stackoverflow-logs.png
Upvotes: 1
Reputation: 63143
Use:
.NET Framework 2.0 SDK ships with Microsoft CLR Debugger. It works similar to Visual Studio debugger (though source files are readonly), so you can give it a try.
Upvotes: 0
Reputation: 8015
If you are catching exceptions, the Exception object contains the stack trace: Exception.StackTrace. Also, you have access to it with Environment.StackTrace.
In the code below there is also an event handler for unhandled exceptions which will write the exception, including the stack trace, to the event log.
// Sample for the Environment.StackTrace property
using System;
class Sample
{
public static void Main()
{
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(UnhandledExceptions);
Console.WriteLine("StackTrace: '{0}'", Environment.StackTrace);
throw new Exception("Fatal Error");
}
static void UnhandledExceptions(object sender, UnhandledExceptionEventArgs e)
{
string source = "SOTest";
if (!System.Diagnostics.EventLog.SourceExists(source))
{
System.Diagnostics.EventLog.CreateEventSource(source, "Application");
}
System.Diagnostics.EventLog log = new System.Diagnostics.EventLog();
log.Source = source;
log.WriteEntry(e.ExceptionObject.ToString(),
System.Diagnostics.EventLogEntryType.Error);
}
Upvotes: 6