用VS.NET Debug時,當例外(Exception)發生,如果拋出例外的Code已被try … catch的例外處理包覆,預設是不會觸發Debugger中斷的。而一旦進入catch的範圍,錯誤發生在哪一行就變得不可考了。我們就可以由選單Debug/Exceptions設定”When the exception is thrown”選項,由Continue改為Break into the debugger,這樣有任何錯誤發生,不管有沒有try..catch,都會觸發Debugger,停在出問題的那行程式碼上!
不過,繼上次歷經了Navigate Forward/Backward失蹤記,發現VS 2005預設又把Exceptions選單給藏起來了。如果要用,可以按快速鍵Ctrl-Alt-E或用下圖的方法把它找回來。


Comments

Be the first to post a comment

Post a comment