Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
317 views
in Technique[技术] by (71.8m points)

c# - How do I make Visual Studio 2015 ignore handled exceptions?

So I have this chunk of code, and when debugging in Visual Studio, it's breaking even though the exception is handled in my code. I only want it to break when this exception is unhandled by my code. The Exceptions Settings box only has an option to continue on unhandled exceptions in user code, but that's not acceptable because I still need it to break if it's unhandled. I've seen screenshots of previous versions of VS that had an option for this. Is this a VS 2015 bug or did microsoft remove the functionality, or am I just missing something here?

enter image description here

question from:https://stackoverflow.com/questions/66064218/how-to-not-break-on-handled-exceptions

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In the Exception Settings window, when they are checked like they are in your picture it will always break, even if handled (notice the window says Break When Thrown).

You can right-click on the Common Language Runtime Exceptions and select Restore Defaults in the context menu, which will change it back to only break when unhandled.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...