C# catch a stack overflow exception

前端 未结 9 1068
生来不讨喜
生来不讨喜 2020-11-22 09:12

I have a recursive call to a method that throws a stack overflow exception. The first call is surrounded by a try catch block but the exception is not caught.

Does

9条回答
  •  半阙折子戏
    2020-11-22 09:56

    You can't. The CLR won't let you. A stack overflow is a fatal error and can't be recovered from.

提交回复
热议问题