C# exceptions not showing filename/line numbers (PDB issue?)

  • Thread starter Thread starter Arun Bhalla
  • Start date Start date
A

Arun Bhalla

Hi,

I'm developing an Explorer bar using VS.NET 2003 (C#) on Windows XP. For
some time, I've noticed that I don't have filenames and line numbers
appearing in my exceptions' stack traces. On the other hand, debugging with
breakpoints, etc. seems to work fine in VS.NET 2003. I can't understand why
this isn't working -- and I think it used to work, perhaps under VS.NET
2002, but maybe not. The information doesn't appear in exceptions when
running under VS.NET or when not.

I am running my Explorer bar (which is a class library, not an application)
on the same machine (and user account) which built the library. The PDB
file is accessible to me, and its location does match the location in the
assembly. I am making Debug builds, and I do have "Generate debugging
information" enabled. As far as I can tell, the PDB and DLL files are
equally fresh and the same version?

Any tips? Is this a known bug? It's driving me batty trying to locate an
exception in code blocks without any help from line numbers.

Thanks!
Arun
 
Tell me this. When you run the project from Visual Studio, or attach to the
process after it's started, look in your Output tab for all the assembly
loading logs. Find the one for the assembly in question. See whether it says
"Symbols Loaded" or "No symbols loaded". The symbols in question are,
obviously, the debugging symbols. From your description, I suspect that it
is loading the debug symbols. Tell me if this is your situation: When
running the program by pressing F5 on your project, you encounter an
exception and the standard exception dialog appears with a stack trace but
no line numbers.

I do believe that whether or not you have a pdb, the only time you get line
numbers in your stack traces is when you're *actually debugging* the
project. Now, I could be wrong, but this is my experience.

Chris
 
Thanks for responding...

When I hit F5 (Start), I do see that symbols are being loaded for the
assembly in question. However, when an exception occurs in my assembly, I
don't see the line numbers in the MessageBox which I popup containing the
exceptions StackTrace, etc. I hope it doesn't matter, but again I'm writing
an Explorer bar, which is a class library that gets loaded by Internet
Explorer.

I decided to try a new Windows Application solution. I was able to throw
and catch an exception and display the line numbers in a MessageBox there.
It also didn't matter if I Started the project (F5) or Started without
debugging (Ctrl-F5).

Any ideas?

cheers,
Arun
 
Is the PDB file in the same directory as the dll when IE loads it? Where
does it load it from?
 
I figured out yesterday that the issue was that the DLL was in the GAC, and
the PDB path
in the DLL was relative (./). When I copied the PDB file to the same
directory in the GAC,
it worked.

Thanks,
Arun
 
Hi Arun,

I have the same problem as you have (had).
Did you find a solution for it allready or does anybody who reads this now
know how to solve it?

Thanks, Marco (puzzled)
 
Hi Dave,

This sounds good.

Only I get a build message that only assembly files (not pdb files) can be
shared in the GAC. I do the copying action via the Setup projects File
System on target machine, Global Assembly Cache folder.
I selected the pdb file I wanted to have in the GAC and set it into this
folder.

My Windows Service (.exe) assembly is installed to the folder "C:\Program
Files\NameCompany\MyServiceSetup"

Can you be a bit more specific on what I have to do?

Thanks, Marco
 
I'm not sure how you would do this automatically. You don't want to share
the pdb file or to install it, you only want to copy it.

You can manually copy the pdb files to the GAC. There's a registry switch (I
don't recall which one but you should be able to google it up) that allows
you to turn off the standard explorer display of the GAC so that it shows up
as if it were a directory filled with folders. Locate the folder your DLL is
in and manually copy the pdb there.
 
Back
Top