Is there a way to display the lines in the stack trace for the .NET assembly build/deployed in Release mode?
UPDATE:
My application is divided into three class library projects and one ASP.NET "website" project. The error I am trying to track down is in one of the three class library projects. I only deployed the pdb file for the class library project that is generating the "Object reference not set to an instance of an object" error.
The line numbers are still not showing up in the stack trace. Do I need to deploy the pdb files for all projects to get the line numbers in the stack trace?
Working solution
Deploying the pdb file for each application fixed the line number issue.
Check the DEBUG constant parameter.Implemented with the comment below:
My solution
Copy pdb file in same folder that executable file.
now i can view the line number when run the exe file.
this is reason
http://msdn.microsoft.com/en-us/library/ee416588%28v=vs.85%29.aspx
This works every time. You just need to substring the stack trace message. Real Easy! Also, in vb.net you do need to do the "Show All Files" and include the pdb.
C# version:
In VS 2008 Express, I found it under Project Properties --> Compile --> Advanced Compile Options.
In VS2012 you need to uncheck "Exclude generated debug symbols" in the Package/Publish Web section of the properties as well.
I've run into problems in the past where I feel the need to deploy PDB files with a release build in order to track down an error. The reason is, like you said, was that the exception occurred in a method that was very large and I could not accurately pinpoint where it was happening.
This might be an indication that the method needs to be refactored into smaller, more granular methods. Not a one size fits all answer, but this approach has served me well in the short term (I've often found the bug during the refactoring) and in the long run.
Just a thought.