Visual Studio how to serialize object from debugger

后端 未结 10 1192
轻奢々
轻奢々 2020-12-22 16:39

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

10条回答
  •  天涯浪人
    2020-12-22 17:24

    Use this in Visual Studio's "Immediate" window, replacing c:\directory\file.json with the full path to the file to which you'd like to write the JSON and myObject with your variable to serialise:

    System.IO.File.WriteAllText(@"c:\directory\file.json", Newtonsoft.Json.JsonConvert.SerializeObject(myObject))
    

提交回复
热议问题