A Visual Studio and Visual Studio Code extension for exporting in-memory objects during debugging to C# Object Initialization Code, JSON, Visual Basic Object Initialization Code, XML, and YAML string.
Inspired by ObjectExporter.
The closest alternative is proprietary OzCode export functionality.
"Dump as" commands are available via context menu in the Code and Immediate windows.
It opens the dumped object in a separate document window.
- How to compare two dumped objects:
- Enable option "Show Miscellaneous files in Solution Explorer":
- Install a diff extension - I verified the Heku.VsDiff
- Select files in Solution Explorer under the Miscellaneous Files folder -> Right click -> Compare Selected Files:
- C#, F# and VisualBasic project languages are currently supported only.
- netstandard 2.0+, netcore2.0+, netframework 4.5+
- if you are debugging the solution in Release mode or debuging DLLs from another source, such as a nuget package, you'll get an error message: "Cannot evaluate expression because the code of the current method is optimized" or "error CS0103: The name 'YellowFlavor' does not exist in the current context". Solution: switch to Debug mode or turn the Tools > Options > Debugging > General > Suppress JIT optimization on module load option on.
- local debugging only.
- if you see any encoding-related issues, please select the option: Tools > Options > Environment > Documents > Save documents as Unicode when data cannot be saved in codepage.
- it doesn't work for UWP applications, because UAP doesn't support Assembly.LoadFrom. You can bypass this restriction by referencing the .nestandard20 version of Serialization lib and calling:
_ = ObjectSerializer.Serialize(null, "cs"); for loading the serializer into executing assembly. Example
Privacy Notice: No personal data is collected at all.
This tool has been working well for my own personal needs, but outside that its future depends on your feedback. Feel free to open an issue.
Any donations during this time will be directed to local charities at my own discretion.
Thanks to JetBrains for providing an OSS development license of All Products Pack.