On an ASP.NET 2.0 website I log details of unhandled exceptions. I would like to log the source filename and line number, but I don't get this in the stack trace when an exception occurs. The reason for this is that I have debug="false" in the web.config compilation settings (it's a production site), therefore no PDB files are being generated on the server. Is there a way to get ASP.NET to generate the debug symbol files in release mode? I don't want to precompile the site.
You can debug in Release mode to an extent. Debug and Release are simply build configurations (of which you can create many), the real difference is that Debug configuration doesn't optimize the generated binary code (optimized code complicates debugging). It also generates additional debug data which release does not.
Release vs Debug Essentially, they're just 2 separate configurations of the compiler. and it depends on what language you are using, Debug includes debugging information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled.
By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.
To check if there's debug info inside the kernel object, you can add the following at the end of the objdump command: | grep debug . If this string is found, you know the kernel object contains debug information. If not, then it's a "clean" kernel object.
OK, I found an answer. You can set debug="false" to get optimisations, and then set compilerOptions="/debug:pdbonly" in the system.codedom compiler settings to get symbols. Here's the relevant web.config excerpts:
<system.web>
....
<compilation debug="false" defaultLanguage="c#">
...
</compilation>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
compilerOptions="/debug:pdbonly">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
...
</compilers>
</system.codedom>
Unless Im missing something the difference between debug & release build are in the optimizations. You should be able to create a normal debug binary with pdb and make sure to enable all the optimization settings in the project settings. Afaik unless theres an exception the pdb file wount be loaded, etc...
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