Question

In Eclipse, java will force you to have a try catch block for functions that throw exceptions. Can you get VS to do the same?

Was it helpful?

Solution

This is not a distinction between Eclipse and Visual Studio, but between Java and C#. Java has checked exceptions which have to be caught; C# doesn't.

OTHER TIPS

Red Gate Software created a static analysis program called Exception Hunter to bring this functionality to C#. The program has since been retired due to the overwhelming complexity and relatively little benefits it ended up providing.

Sorry, Exception Hunter has been discontinued.

With the release of .NET 4.0 and WPF, the number of exceptions that the CLR can throw was greatly increased, to the point of being overwhelming. The exclusions list can no longer cover all the unlikely exceptions that the CLR may throw. This means that, although Exception Hunter will provide accurate results, these results will include a long list of potential exceptions, most of which are nothing to worry about. In essence, the tool has become a lot less usable and makes your job harder than it should be. This goes against our ingeniously simple ethos, so we have decided to stop selling new licenses for the product.

Read more on our Support Center.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top