Wednesday, 15 June 2011

c# - Is true != true, or is AccessViolationException strange -



c# - Is true != true, or is AccessViolationException strange -

whilst writing code ran unusual situation if returns true, if test false. have dumbed downwards code see if missing something, throw accessviolationexception() keeps executing.

bool valid = true; if (valid != true) { throw new accessviolationexception("wtf"); }

does accessviolationexception have unusual powers, or has computer gone off deep end?

edit: "dumbed down" means took out functions , code left with. these few lines re-create , paste of in application. real code

edit 2: cleaned solution, rebuild, rebooted.

the code looks , still getting same problem if returns true.

bool valid = true; if (valid != true) { throw new exception("wtf"); }

similar code in function works expected. above code in function @ moment.

i pretty sure, code not that, running on computer. unusual reason compiler not compile code (well), , of previous version runs. rebuilding (as mentioned in 1 comment) try, not sure succeeds. instead:

exit visual studio delete "bin" , "obj" folders in project directory open vs , project, again comile, run, , happy.

c# exception logic

No comments:

Post a Comment