Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

If Condition Not Evaulated

I've got an If statement inside the Finally section of a Try block.  When the If statement is on one line, like

If SomeBooleanVar Then DoSomething()

DoSomething is always called no matter what the value of SomeBooleanVar.  However, if the If statement is on multiple lines, like

If SomeBooleanVar Then
  DoSomething()
End If

SomeBooleanVar is evaluated as expected.

- Rebooted my laptop with no change.
- Ran through the code SEVERAL times and confirmed in the watch window that the condition evaluated to False, but DoSomething was still called.
- Made a test app to confirm the bug, but the test app works as expected.

Any ideas why this is happening?  Thanks in advance,

Joe Paradise
Wednesday, July 14, 2004

Looks like this may be a known bug:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=ucWn2NHpDHA.2776%40tk2msftngp13.phx.gbl&rnum=1&prev=/groups%3Fq%3Ddotnet%2Bif%2Bcondition%2B%2522not%2Bevaluated%2522%2B%2522end%2Bif%2522%26sourceid%3Dmozilla-search%26start%3D0%26start%3D0

According to the 3rd post, this is just a debugger error and the code inside the If block is not actually run.

I just tested this and while the debugger shows it hitting the code, the statement is not actually run.

Joe Paradise
Wednesday, July 14, 2004

*  Recent Topics

*  Fog Creek Home