【问题标题】:InsufficientExecutionStackExceptionInsufficientExecutionStackException
【发布时间】:2011-07-26 09:17:23
【问题描述】:

有没有人遇到过InsufficientExecutionStackExceptionMSDN 并没有透露太多。

InsufficientExecutionStackExceptionStackOverflowException 有什么区别?

【问题讨论】:

    标签: .net exception exception-handling clr


    【解决方案1】:

    这个异常是由RuntimeHelpers.EnsureSufficientExecutionStack 抛出的。见https://msdn.microsoft.com/library/system.runtime.compilerservices.runtimehelpers.ensuresufficientexecutionstack.aspx

    StackOverflowException 相比,您可以捕捉InsufficientExecutionStackException 并优雅地处理这种情况。

    【讨论】:

      【解决方案2】:

      来自CLR Via C#

      就在调用方法之前,您 可以通过以下方式检查是否有足够的堆栈空间 调用 RuntimeHelper 类的 EnsureSufficientExecutionStack 方法 此方法检查是否调用 线程有足够的堆栈空间 可用于执行平均
      方法(定义不明确)如果 堆栈空间不足,则 方法抛出一个 InsufficientExecutionStackException 你可以赶上 EnsureSufficientExecutionStack 方法 不接受任何参数并返回 void 该方法通常用于 递归方法

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多