Lak Posted October 16, 2003 Posted October 16, 2003 Pls take a look at this peice of code : int a=1; int b=2; try { if (a==b) { Console.WriteLine("wrong"); //This loop should never be enetred. } } catch(Exception e) {} The if loop should never be entered, but it is entered inside the try block.Could someone tell me why??? Thanks. Quote
Administrators PlausiblyDamp Posted October 16, 2003 Administrators Posted October 16, 2003 When I tried it in the debugger it stepped through as I would expect, after the if(a==b) it exited the if statement block and the message was never written to the screen. Are you sure you have the code exactly the same not if (a=b) for example? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Lak Posted October 16, 2003 Author Posted October 16, 2003 yes, the message is never written to the screen, since the statement is never executed. but it enters the loop while i am debugging.i guess for some reason my debugger shows the line being debugged as one line ahead of what it actually is doing.Do you know why??? Thanks Quote
Administrators PlausiblyDamp Posted October 16, 2003 Administrators Posted October 16, 2003 You actually see the debugger go to the line Console.WriteLine("wrong"); //This loop should never be enetred. if so look in the debug directory and delete any *.pdb files you see there and do a rebuild and try the debugger again. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
JumpsInLava Posted October 16, 2003 Posted October 16, 2003 I've had that happen as well when I am stepping through something in debug, it highlights the line, but doesn't execute.... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.