Visual Studio Debugger Voodoo

Posted by LoveMeSomeCode on Stack Overflow See other posts from Stack Overflow or by LoveMeSomeCode
Published on 2010-05-14T16:58:46Z Indexed on 2010/05/14 17:04 UTC
Read the original article Hit count: 246

Filed under:
|
|

Ok, maybe this isn't so amazing considering I don't really understand how the debugger works in the first place, let alone Edit and Continue, which is totally amazing.

But I was wondering if anyone knew what the debugger is doing with variable declarations in this scenario. I can be debugging through my code, move the line of execution ahead - past a variables initial declaration and assignment, and the code still runs ok. If it's a value type it will have it's default value, for a ref type, null.

So if I create a function that uses a variable before it's declared it won't compile, but if I use the debugger to run it that way it will still run without error. Why is this? And is this related to the fact that you can't put a breakpoint on a declaration?

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about c#