In a .net Exception how to get a stacktrace with argument values

前端 未结 11 1434
南方客
南方客 2020-12-01 01:58

I am trying to add an unhandled exception handler in .net (c#) that should be as helpfull for the \'user\' as possible. The end users are mostly programers so they just need

11条回答
  •  我在风中等你
    2020-12-01 02:42

    I don't believe there is a built-in mechanism. Retrieving each frame of the stack trace, while allowing you to determine the method in the trace, only gives you the reflected type information on that method. No parameter information. I think this is why some exceptions, notably, ArgumentException, et. al. provide a mechanism to specify the value of the argument involved in the exception since there's no easy way to get it.

提交回复
热议问题