How to Trace all local variables when an exception occurs

前端 未结 4 1473
面向向阳花
面向向阳花 2020-12-28 09:27

any generic way to trace/log values of all local variables when an exception occurs in a method? (in C# 3)

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 09:58

    You can't, basically. Reflection lets you get at instance (and static) variables but if you want to log local variables, you'll have to do so explicitly. It's possible that you could do a bit better using the profiling API, but that would be a pretty extreme step.

提交回复
热议问题