Obtain parameter values from a stack frame in .NET?

前端 未结 1 617
误落风尘
误落风尘 2020-12-03 07:57

I would like to be able to obtain all the parameter values from the stack frame in .NET. A bit like how you\'re able to see the values in the call stack when in the Visual S

相关标签:
1条回答
  • 2020-12-03 08:11

    It seems it can't be done that way. It will only provide meta information about the method and its parameters. Not the actual value at the time of the callstack.

    Some suggest deriving your classes from ContextBoundObject and use IMessageSink to be notified off all method calls and the values of the parameters. This is normally used for .NET Remoting.

    Another suggestion might be to write a debugger. This is how the IDE gets its information. Microsoft has Mdbg of which you can get the source code. Or write a CLR profiler.

    0 讨论(0)
提交回复
热议问题