views:

224

answers:

1

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.

+1  A: 

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

dario
@Dario: I want to make sure I understand you on this. Because I publish only files needed to run the app, there is no source code published to the production webserver. But if I push out a .PDB file along with the corresponding .DLL, then when I request a Stack Trace it will show the line number(s) in files on my development machine (that is, the machine from which I initiated the PUBLISH operation). So a System Admin seeing this sort of file ref on a production machine should not freak out because there is no such user in c:\Documents and Settings on the web server. Do I have this correctly?
John Galt
Yes, PDB files contains information about user who publihed application (in other words: who compile and make .dll and coresponding .pdb files).
dario