Stack file information

G

Guest

I have posted a few messages in the last couple weeks
about my not being able to track down the file information
from the call stack.
The issue still remains. My C# assembly is in the GAC. I
have copied the pdb file manually to the GAC folder
C:\winnt\assembly. Still can't get the file name and file
line number info. I am getting a frame count of 4 though.
Can anyone please help me to fix this problem? BTW, thanks
everyone who has given suggestions to me to resolve the
issue. The suggestions were all very helpful.

StackTrace Trace = new StackTrace(true);
int Count = Trace.FrameCount;
StackFrame Frame = Trace.GetFrame(0);
String FileName = Frame.GetFileName();
int LineNumber = Frame.GetFileLineNumber();

Hi all
I posted this question a few days back. I am trying the
above code in my C# assembly. I get Count as 4. But no
matter how I try, I can't get the correct filename and
linenumber. They are always null and 0 respectively. Can
anyone help me resolve this issue?
I am using a debug build of my assembly.
Thanks a lot in advance for your replies.


..
 
D

Daniel O'Connell [C# MVP]

Most likely its due to the location of the PDB file. ALthough the gac may be
centered in the assembly folder, if memory serves there is a complex mesh of
underlying folders, one of which your executable exists in. You *might* be
able to coyp the pdb to
c:\winnt\assembly\gac\<your.Assembly.Name>\<your.assembly.version>__<assembly
public key>\ which is where it seems the actual files are held, but I don't
know fi that will work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top