w0051977
w0051977

Reputation: 15807

Debugger jumping all over the place

I have added a reference to a DLL from another project (contained in the bin folder) and I have set Copy local to true. When I step through the code; the debugger jumps all over the place. I believe this is because the code is optimised. I have two questions:

  1. Is this because the code is optimised
  2. If (1) is true then why can I step through the code in the first place i.e. without Reflector.

Upvotes: 1

Views: 470

Answers (2)

Karl Anderson
Karl Anderson

Reputation: 34846

My guess is the jumping is due to the PDB (symbols) being out of sync with the compiled DLL, thus the symbols tell VS to go to a line number that does not actually match up with what the code is actually doing; optimization may also play a part as well, because of in-lining functions.

Other things that influence the debugging experience are:

  1. Just My Code setting
  2. Methods explicitly marked with DebuggerNonUserCode attribute

Upvotes: 1

Mark Brackett
Mark Brackett

Reputation: 85655

Debugging optimized code may "jump around", as some functions become inlined. The most telling thing is that local variables usually get optimized away, giving a message to that effect when trying to read them.

If the jumping seems to make very little sense, though, then it's more likely you have the wrong PDB (which maps to line numbers) or source (which has the line numbers).

Upvotes: 0

Related Questions