Search code examples
asp.netweb-servicesstack-traceevent-logdebug-symbols

Is showing the Exception StackTrace useful in a RELEASE assembly or only a DEBUG .dll


I've gone to some lengths to improve the error handling in my webservice - in particular, showing the StackTrace as in this example:

catch (Exception ex)
        {
            EventLog log = new EventLog();
            log.Source = g_EventSource;
            StringBuilder msg = new StringBuilder("Exception in UpdateRecord method has been logged:");
            msg.Append(Environment.NewLine);
            msg.Append("passedURL="); msg.Append(passedURL);
            msg.Append(Environment.NewLine);
            msg.Append(ex.Message);
            msg.Append(Environment.NewLine); 
            msg.Append(ex.Source);
            msg.Append(Environment.NewLine);
            msg.Append(ex.StackTrace);
            log.WriteEntry(msg.ToString(), EventLogEntryType.Error, 100);
            return msg.ToString();
        }

My question is what will happen when I publish my webservice having compiled it as RELEASE instead of DEBUG? I only publish the .dll and the web.config (no source) now when I compile in DEBUG mode but when an error is logged the StackTrace points back to line numbers of file(s) in my development machine like:

C:\Documents and Settings\johna\My Documents\Visual Studio 2008\Projects\   etc.

In short, will a RELEASE mode DLL still show the above sort of stack trace? I think it will but not sure; my system administrator has raised this question as we prepare for a move into another level of deployment.


Solution

  • You can have line numbrers in Stack Trace messages but you need to include .PDB files. No problems even in release mode.