[Mono-devel-list] Stack frames with null methods

Kornél Pál kornelpal at hotmail.com
Mon May 23 09:21:24 EDT 2005


Hi,

Stack frames can be obtained usually using two ways:
1. Stack trace from an Exception
2. The current stack trace

.NET Framework returns only stack frames with non-null methods.

Mono returns track frames for wrapper functions created by the runtime.
These wrapper functions have no methods associated.

The problem is that StackFrame.GetMethod() may return null on Mono but never
returns null on .NET Framework.

As I know there is no way to get the wrapper function name using managed
code from the runtim on Mono.

I think returning stack frames with null methods is useless.

There is a bug in corlib:
Current StackTrace returns no null methods but StackTrace for an Exception
returns null methods. The behaviour regarding null methods should be
consistent.

The only case when wrapper method can be identified is Exception.StackTrace
property as it calls the internal GetInternalMethodName method of
StackFrame.

Note that the StackFrames of wrapper methods are ignored in the current
StackTrace.

Sometimes it can be good if you know that the exception ocurred in a wrapper
method but StackFrames with null method infos are useless and are making
Mono inclompatible with .NET Framework.

I think the solution sould be not to return StackFrames with null methods in
any cases (current or exception StackTrace) but include them in the string
representation of both stack traces.

Comments are welcomed about stack frames with null methods.

Kornél




More information about the Mono-devel-list mailing list