Other Software > Developer's Corner
C# & Visual Studio Problem
mwb1100:
So, just to be clear, the *program* works fine if you have a constant `false` controlling the `if` - the problem is that the debugger is unable to deal correctly with variables scoped to the `else` clause. Is that a fair summary?
kyrathaba:
WTF? It's normal again...
Has anyone heard of this kind of wonkiness before?
--- End quote ---
Yes, I have. Per discussion with a tech of MSDN, it's a bug in the Debugger.
Renegade:
So, just to be clear, the *program* works fine if you have a constant `false` controlling the `if` - the problem is that the debugger is unable to deal correctly with variables scoped to the `else` clause. Is that a fair summary?
-mwb1100 (January 16, 2011, 11:37 AM)
--- End quote ---
Yes.
"if (false)" results in locally scoped variables declared in else clauses not being available to the debugger, but still functioning properly in the software.
Here's something you can copy & paste in VS to have a quick look:
--- Code: C# ---string test1a = "Hello";int test2a = 4;string test1c;int test2c;if (false){}else{ string test1b = test1a + " world!"; // can't see 1b int test2b = test2a * test2a; // can't see 2b test1c = test1b; // can see 1c, not 1b test2c = test2b; // can see 2c, not 2b Console.WriteLine("Break here :" + test1b + test2b.ToString()); // this works as expected, but can't see during debugging}
Navigation
[0] Message Index
[*] Previous page
Go to full version