Empty StackTrace. Possible?

时间秒杀一切 提交于 2019-12-14 01:12:17

问题


Are there any possible scenarios where the Stack Trace can be completely empty? I was passed an Event Log text copied from machine Event Properties, which says the following:

Description: An unhandled exception occurred and the process was terminated.

Application ID: DefaultDomain

Process ID: 123

Exception: System.OutOfMemoryException

Message: Exception of type 'System.OutOfMemoryException' was thrown.

StackTrace:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

The Stack Trace looks suspicious to me. I searched a lot on forums and documentations - there is nothing about Stack Trace being empty. Only MSDN mentions "The StackTrace property may not report as many method calls as expected because of code transformations, such as inlining, that occur during optimization." but nothing about no method call reports at all.

I need to be sure before I contact back for confirmation, because this is a multilayer communication and is going to take time for the reponse..

Any corrections to my suspects that the Stack Trace cannot be empty?


回答1:


Sometimes, the callstack itself might be the cause of the OOM (too much in the call stack).

So... you see the problem.

Or the heap might be exhausted, or... or, see @Oded comment !




回答2:


To create the message in the event log the string property Exception.StackTrace has to be retrieved. Computing the value for this property involves creating a new StackTrace object. If the application is out of memory this may not be possible because the allocation fails. This may explain why the stack trace is missing.

When an application runs out of memory even error handling like logging may fail as a result of lack of resources. In your case you at least know that it was an out of memory situation that triggered the failure.



来源:https://stackoverflow.com/questions/10530772/empty-stacktrace-possible

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!