Reputation: 577
I have a web application that works fine on my development machine but when I install it on another machine, it just crashes on one of the new methods I added to a DLL.
Looking deeper into it, the installed does not take the PDB files whereas they are on my dev machine. So I tried to remove them on the dev machine and my new method crashes the same. Other methods don't crash at all.
My method just throws up a "NullPointerException" that never comes up when the PDB files are present.
I know what the PDB files are for (I searched this site before posting) but this should not alter the way the application works. Should it?
EDIT: Forgot to mention that all is in <release>
not <debug>
. That is why I question about the PDB files.
Upvotes: 4
Views: 291
Reputation: 577
I found what is going wrong in my code. In the logger part, using log4Net, I have code like this:
public static void Info(string strMsg)
{
StackTrace st = new StackTrace(true);
StackFrame sf = st.GetFrame(1);
_log.Info(string.Format("{0,-25} L{1:0000} {2}", sf.GetFileName().Substring(sf.GetFileName().LastIndexOf(@"\") + 1), sf.GetFileLineNumber(), strMsg));
}
So I changed the entries to something like this:
public static void Debug(string strMsg)
{
StackTrace st = new StackTrace(true);
#if DEBUG
StackFrame sf = st.GetFrame(1);
_log.Debug(string.Format("{0,-25} L{1:0000} {2}", sf.GetFileName().Substring(sf.GetFileName().LastIndexOf(@"\") + 1), sf.GetFileLineNumber(), strMsg));
#else
_log.Debug(string.Format("{0}",strMsg));
#endif
}
And now all works fine without the PDB files. So picking information from the stacktrace requires PDB files.
Upvotes: 3