.NET: How to convert Exception to string?

前端 未结 10 622
隐瞒了意图╮
隐瞒了意图╮ 2021-01-30 10:47

When an exception is thrown (while debugging in the IDE), i have the opportunity to view details of the exception:

10条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 11:17

    In visual studio that sort of information can be outputted by a debugger visualizer.

    I assume that because it is possible to write your own debugger visualizer: http://msdn.microsoft.com/en-us/library/e2zc529c.aspx

    That in theory, if your can reverse engineer the built-in debugger visualizer for exceptions (if your can work out where they are stored) then you could use the same functionality.

    EDIT:

    Here is a post about where the debugger visualizers are kept: Where do I find Microsoft.VisualStudio.DebuggerVisualizers?

    You might be able to use it for your own purposes.

提交回复
热议问题