Way to automatically see which functions can poten

2019-01-15 09:58发布

nothing more frustrating than to see your code crash in the debugger on a method which exceptionned and you didn't try/catch it.

Is there an easy way to scan through your sources and tag all functions which can potentially throw exceptions?

Does the build in visual assist have some hidden option to colour these functions in a specific color?

thanks

R

13条回答
干净又极端
2楼-- · 2019-01-15 10:23

As others have said, I'm not sure if you'll find a foolproof way of doing this in C# since doesn't support checked exceptions.

As a bit of an aside, this reminded me of an interview with Anders Hejlsberg discussing "The trouble with Checked Exceptions". I'm not trying to flame checked exceptions, but suggesting that you read Ander's rationale behind C#'s exception design and the suggested way for handling exceptions: centralized exception handling.

查看更多
登录 后发表回答