Visual Studio how to serialize object from debugge

2019-01-21 01:26发布

I'm trying to investigate a bug in a crash dump (so I can not change the code). I have a really complicated object (thousands of lines in the serialized representation) and its state is inconsistent. To investigate its state the Visual Studio debugger view is useless. But the object has a data contract. I'd like to serialize it and then use my favorite text editor to navigate across the object. Is it possible to do the from the debugger?

7条回答
女痞
2楼-- · 2019-01-21 02:24

It might be possible to use the intermediate window to serialize it and then copy the content to your favorite editor.

Another option is to override the ToString() method and call it while in debug mode.

You can also write the contents out to a file shortly before the crash, or wrap the code into a try/catch and write the file then. I'm assuming you can identify when it's crashing.

查看更多
登录 后发表回答