Geeks With Blogs
Colin Bowern ... more of the usual bool

Have you ever had the need to get line numbers from an exception stack trace for an assembly in the GAC?  If you work with BizTalk Server the answer is likely yes.  To debug Commerce Server pipeline components which I have traditionally put custom C# pipeline components in the GAC and then registered for COM interop.  I've found having line numbers indespensible when apps are running in the production test environment. I went searching for the answer and came across it.  I thought I'd write it down here so I remember it.

To get line numbers with your stack trace:

  1. When compiling both debug and release builds make sure to generate a program database (aka symbols). 
    • For release builds you'll want to make sure you use the correct switch, /debug:pdbonly, since /debug:full disables optimization.
  2. When you need line numbers place the .pdb file beside your assembly (in the same folder). 
    • For GAC assemblies you'll need to put it in the assembly folder (e.g. c:\windows\assembly\gac\\__)
    • Be aware that the .NET Framework 2.0 is adding platform specific GAC folders (e.g. GAC, GAC_32, GAC_MSIL, etc...).

Then you should have line numbers in your stack traces.  It's great for debugging and the program databases can be in place for explicit debugging needs and then removed if you don't feel comfortable with them there.

Posted on Monday, February 6, 2006 7:17 PM Build and Deployment | Back to top


Comments on this post: A More Complete Stack Trace when Debugging Assemblies in the GAC

# re: A More Complete Stack Trace when Debugging Assemblies in the GAC
Requesting Gravatar...
Thanks - just helped me!

I copy my .pdb files to:

C:\WINDOWS\assembly\GAC\<Assembly Name>\<Version>__<Public Key Token>

using the Command Prompt (and a .cmd file)

Hans
Left by Hans Kierulff on Apr 12, 2006 6:32 AM

Your comment:
 (will show your gravatar)


Copyright © Colin Bowern | Powered by: GeeksWithBlogs.net