简体   繁体   English

你如何强迫VS让你处理异常?

[英]How do you force VS to make you handle exceptions?

In Eclipse, java will force you to have a try catch block for functions that throw exceptions. 在Eclipse中,java将强制您为抛出异常的函数设置try catch块。 Can you get VS to do the same? 你能让VS做同样的事吗?

This is not a distinction between Eclipse and Visual Studio, but between Java and C#. 这不是Eclipse和Visual Studio之间的区别,而是Java和C#之间的区别。 Java has checked exceptions which have to be caught; Java检查了必须捕获的异常; C# doesn't. C#没有。

Red Gate Software created a static analysis program called Exception Hunter to bring this functionality to C#. Red Gate Software创建了一个名为Exception Hunter的静态分析程序,将此功能引入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. 对不起,Exception Hunter已经停产。

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. 随着.NET 4.0和WPF的发布,CLR可以抛出的异常数量大大增加,达到了压倒性的程度。 The exclusions list can no longer cover all the unlikely exceptions that the CLR may throw. 排除列表不再涵盖CLR可能抛出的所有不太可能的异常。 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. 这意味着,虽然Exception Hunter将提供准确的结果,但这些结果将包括一长串潜在的例外情况,其中大多数都无需担心。 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. 在我们的支持中心了解更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM