My site crashes without PDB files

I have a web application that works fine on my development machine, but when I install it on another computer, it just crashes into one of the new methods that I added to the DLL.

Peering at it, the installed one does not accept PDB files, while they are on my dev machine. So I tried to delete them on the dev machine, and my new method will fail. Other methods do not crash at all.

My method simply throws a "NullPointerException" that never appears when PDB files are present.

I know why PDB files are needed (I looked at this site before publishing), but this should not change the way the application works. Should he?

EDIT: Forgot to mention that everything is in <release> not <debug> . This is why I am asking a question about PDB files.

+4
source share
1 answer

I have discovered what is happening in my code. In the logger part, using log4Net, I have this code:

 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 everything works fine without PDB files. Therefore, to collect information from stacktrace, PDB files are required.

+3
source

Source: https://habr.com/ru/post/1443275/


All Articles