一般來說,在 try { …  } 範圍發生的例外(Exception)不會觸發Visual Studio偵錯中斷,若想改成一出錯就中止執行,一直以來我都是由Visual Studio DEBUG選單找到Exceptions選項:

開啟Exceptions設定把「Common Language Runtime Exceptions」勾起來:

最近在Visual Studio 2015想做相同設定,卻發現「Exceptions」選項不見了!原來VS2015幫它搬了家,並更名為Exception Settings,快捷鍵則仍維持Ctrl + D, E:

Exception Settings也不再採Modal Dialog強制式對話框,改成常駐視窗,預設跟輸出(Output)、錯誤清單(Error List)放在同一區:

VS2015更動UI的理由,是為了加入新功能。新版的設定介面可使用關鍵字過濾尋找特定例外項目:

Exception清單可加入自訂Exception型別

至於舊版的未處理(User Unhandled)選項,在VS2015被移到右鍵選單的「Continue When Unhandled in User Code」。

延伸閱讀:The New Exception Settings Window in Visual Studio 2015 - Microsoft Application Lifecycle Manage


Comments

Be the first to post a comment

Post a comment