StackOverflowException in .NET

后端 未结 4 1336
名媛妹妹
名媛妹妹 2020-11-27 22:02

After hitting a few StackOverflowExceptions in .NET I noticed they completely bypass the unhandled exception handlers that .NET offers (Application.ThreadException / AppDoma

4条回答
  •  被撕碎了的回忆
    2020-11-27 22:31

    Not really; a stack overflow, or an out of memory exception happens within the CLR itself means something has gone critically wrong (I usually get it when I've been a dumbass and created a recursive property).

    When this state occurs there is no way for the CLR to allocate new function calls or memory to enable it to call into the exception handlers; it's a "we must halt now" scenario.

    If, however, you throw the exception yourself your exception handlers will be called.

提交回复
热议问题