I would like to know how the CLR locates pdb symbol files, and if this behavior can be overridden.
I looked online (MSDN and other resources) but could not find a good answer.
In my app, i have DLLs placed in several subdirectories of the main .EXE path.
I would like to have a Symbols\ dir that will contain all symbols for my application. By default, i believe that symbols are picked up from where the assembly is. Can this be changed?
pdb file stores all debug information for the project's .exe file, and resides in the \debug subdirectory.
A PDB file is typically created from source files during compilation. It stores a list of all symbols in a module with their addresses and possibly the name of the file and the line on which the symbol was declared. This symbol information is not stored in the module itself, because it takes up a lot of space.
Some PDB files are stored as plain text, like Geneious' Program Debug Database files, and are completely human-readable if opened in a text editor. You can open this kind of PDB file with any program that can read text documents, like the built-in Notepad program in Windows.
PDB files help you and the debugger out, making post-mortem debugging significantly easier. You make the point that if your software is ready for release, you should have done all your debugging by then.
Look at this blog post if you havn't already:
http://blogs.msdn.com/b/rmbyers/archive/2007/06/21/customizing-pdb-lookup-for-source-information-in-stacktrace.aspx
You could simply set the _NT_SYMBOL_PATH environment variable for your own process. This worked well:
using System;
using System.Runtime.CompilerServices;
using System.Reflection;
using System.IO;
class Program {
static void Main(string[] args) {
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
path = Path.Combine(path, "symbols");
Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", path);
try {
Kaboom();
}
catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
Console.ReadLine();
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Kaboom() {
throw new Exception("test");
}
}
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