How to get a dump of all local variables?

后端 未结 3 624
旧巷少年郎
旧巷少年郎 2020-12-08 15:34

How can I get a dump of all local & session variables when an exception occurs? I was thinking of writing some sort of reflection based function that would interrogate t

3条回答
  •  死守一世寂寞
    2020-12-08 16:23

    This is a question asked ad nauseum on Stack Overflow, although phrased differently. In one thread, the answer was to use PostSharp. As others have suggested dumping the stack trace, you can do that. The easiest would be to manually dump the local variables. This can either be to Trace or you can create your own custom exception handler.

提交回复
热议问题