views:

205

answers:

3

Hi folks,

my friend has made a really helpful class library which I use all the time. I usually use Reflector to see what his code does.

What I really wanted to do was to step through his code while I'm debugging. So he gave me his .pdb file.

  • Foo.dll (release configuration, compile)
  • Foo.pdb

Now, I'm not sure how I can get it to auto break into his code when it throws an exception (his code, at various points, thorws exceptions .. like A first chance exception of type 'System.Web.HttpException' occurred in Foo.dll ...

Can I do this? Do i need to setup something with the Symbol Server settings in Visual Studio ? Do i need to get the dll compiled into Debug Configuration and be passed the .dll and .pdb files? Or (and i'm really afraid of this one) .. do i need to have both the .dll, .pdb AND his source code ...

I also had a look at this previous SO question, but it sorta didn't help (but proof I've tried to search before asking a question).

Can someone help me please?

A: 

I guess you posted link to another question just to prove that you have searched because that question does have an answer to your question.

Giorgi
+1  A: 

Yes you can, if your friend indexes those PDB's, so that the debugger knows where to find the appropriate source in a source-control system, and if your friend uploads those pdb's to a symbol-server, you can perfectly step through the code while debugging.

I have done this for some projects at work, and this works like a charm.

More info about setting up a symbol server:

Source server helps you kill bugs

Setting up a symbol server

Using symstore

Frederik Gheysels
+1  A: 

The answer is in in the linked question, though perhaps it's not blindingly obvious, so I'll say it: yes, you need to have the source code in order to step through the source code. The PDB file only tells the debugger what line of what source file corresponds to a particular machine instruction.

You don't need to set up a "symbol server" or anything like that. Just get him to send you the source. When you load the PDB file Visual Studio will prompt for the location of the source files if they're not at the same path.

Evgeny
True, but if that guy regularly makes changes to his source-code, then he'll has to send that source-code every time he gives the topicstarter a new version of the DLL.And, if the topicstarter uses different versions of that DLL in different projects, then it can become quite a challenge to use the correct source for debuggign ...
Frederik Gheysels
So what's the use of the PDB if i require the source, still? I mean, why doesn't he just give me the source, i compile it and then reference that? i just don't get it :( (BTW, i _don't_ want his source though .. hoping that the pdb will have it in there)
Pure.Krome
The "point" of the PDB is exactly what I said. Even if you compile the source yourself you would have to get the compiler to generate PDB files - that's how debuggers work. More to the point, the benefit in your case is that he doesn't necessarily need to send you *all* the source that you would need to compile the assembly, just the source files you want to step through.
Evgeny
@Evgeny : so, with a symbol server, it's actually a location that holds the source code, which the PDB file says 'goto line X' in file A.cs ?
Pure.Krome