I have got a data migration app writting in .Net 3.0 VS2008.
I have deployed in debug mode and copied the PDB file to the server I want to runit.
I get an exception but no line number.
This is how i display the exception
Why is there no line number of the exception???
Malcolm
string msg = string.Format("{0} {1} {2}",ex.Message,ex.StackTrace.ToString(),ex.Source.ToString());
if(ex.InnerException != null)
msg += string.Format(" {0}", ex.InnerException.ToString());
return msg;
If you aren't getting line numbers, then either
a) The .NET runtime is determining that the .pdb doesn't match the assembly (out of date, compiled with optimizations, etc.)
or
b) The assembly is running from a directory that's different from the one containing the .pdb (a Windows service, for example, runs under %WINDOWS%\System32)
It doesn't sound like the first possibility applies to you, so is this a Windows service or is the execution directory being changed?
In any event, you should be able to use the AppDomain.CurrentDomain.BaseDirectory
property to determine where assemblies and .pdb's would be searched for (by the default, this can be overridden but should be a good indicator if it's being changed)
dont mess with the exception string... trying to pretty it up, just ex.toString() on it to get the stack to unwind and print the info you are looking for
Of course the pdb files need to be there for the debug info. but formatting the exception is completely unnecessary just call ex.toString() and it formats it for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With