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?
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:
Formatted for
C# with the GeSHI Syntax Highlighter [
copy or print]
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
}