ExecutionEngineException

ExecutionEngineException

本文介绍了哪种类型的异常不抓?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多时候,它被提及,只捕获异常,我能处理(投掷,包装和/或记录,或执行一些其他操作)。

A lot of times, it is mentioned to only catch exceptions which I can handle (throw, wrap and/or log, or perform some other actions).

哪些异常不能处理?这是相同的意义不应被抓?我知道,异常可能重新present对象引用被空不应该被抓,因为他们是编程错误,而不是用户挑衅。是否有任何其他的例子吗?另外一个是 ExecutionEngineException

Which exceptions cannot be handled? Is this the same meaning as should not be caught? I know that exceptions which may represent an object reference being null should not be caught, because they are programming errors and not user-provoked. Is there any other example? Another one is ExecutionEngineException.

此外,是行动的一个catch块永远只是重新抛出,包装/重新抛出和日志的过程?是否有过在那里一些其他的动作需要在一个catch块进行的情况?

Also, is the course of action in a catch block always just between rethrow, wrap/rethrow and log? Is there ever a case where some other action needs to be performed in a catch block?

感谢

推荐答案

通常的建议适用,只有抓住你能够处理的。有一个名为IsCriticalException框架这pretty的常用的框架code份来决定是否要吞下异常内部的效用函数。还不如由该走了。它考虑以下关键:

The usual advice applies, only catch what you can handle. There's a utility function named IsCriticalException inside the framework that's pretty commonly used by parts of the framework code to decide whether or not to swallow an exception. Might as well go by that. It considers the following critical:

  • 的NullReferenceException
  • 在StackOverflowException(不可捕获)
  • OutOfMemoryException异常
  • ThreadAbortException
  • ExecutionEngineException(抓不到4.0)
  • IndexOutOfRangeException
  • AccessViolationException

这是一个很好的清单。

这篇关于哪种类型的异常不抓?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 16:25