if(false) is executing :( - can anyone help explain?

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
Guys. Apologies for the C#ness of the video below. I've got a real issue here, biugging me for the past few hours. The condition in my IF is evaluating to false, but VS2010 Pro runs the if block anyway. Noone in my team can explain it; this is a new built laptop, windows 7, vs2010 pro and i've just converted the application to 64bit from its 32bit roots. I'm hestiant to even use this dev env any more if it's compiling code that runs when the IF is false, as it this will be used in banking systems..

Here's a short video, I have the cursor already positioned on the problematic if.. All I do is put the condition into the immediate window immediately before I step over. Condition reports FALSE in the immediate window, but when I choose step over from the debugger menu, it enters the IF regardless.. No prank; any trustworthy soul who uses TeamViewer remote desktop software is welcome to connect to my PC and see this happen for themselves

Video attached.. It's a SWF video so it's in a zip file along with an HTML file that will act as a container.. just extract the two to your desktop and open the HTML, your browser will play the SWF.. Youre free to examine the HTML beforehand using notepad if you have any concerns about its potential content

Cheers
 

Attachments

  • Untitled2.zip
    180.4 KB · Views: 24
I bet you didn't see this:
cslink.png

Though I had a look too and can't explain it regardless. Can you do that with VB.Net code also?
 
I'm not even sure how it manifest here... I'm in 64bit so edit and continue isnt available, so it's not even like I'm Aprils Fooling anyone by editing the source file so it no longer rmatches the program being debugged.. This project has a working IF 5 lines above, and this broken one here.. If the logic was failing universally, neither IF would work..

I cant even guarantee that I'll ever be able to reproduce it reliably?! Only think Idont want, given that I write banking systems, is to do a build and have it execute all the wrong IFs... Could be disastrous if it happens in an account management part
 
Just a thought, but have you tried doing a clean all and then rebuilding your solution? Or deleting the /bin and /obj folders in order to force a rebuild?

I've seen VS get out of sync with the builds before...mostly with GUI changes though, although I have seen it in actual logic. Just make sure you're using the most recent compile.
 
Back
Top