Skip to content

Latest commit

Β 

History

300 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stand With Ukraine

Terms of use?

By using this project or its source code, for any purpose and in any shape or form, you grant your implicit agreement to all the following statements:

  • You condemn Russia and its military aggression against Ukraine
  • You recognize that Russia is an occupant that unlawfully invaded a sovereign state
  • You support Ukraine's territorial integrity, including its claims over temporarily occupied territories of Crimea and Donbas
  • You reject false narratives perpetuated by Russian state propaganda

To learn more about the war and how you can help, click here. Glory to Ukraine! πŸ‡ΊπŸ‡¦

Object Dumper for Visual Studio

VS Marketplace VS Installs License: MIT

Object Dumper is a Visual Studio extension for exporting live .NET objects during debugging into reusable C#, Visual Basic, JSON, XML, or YAML representations.

Instead of manually expanding a large object graph and copying debugger values one by one, pause at a breakpoint, select an expression in the Code or Immediate window, choose Dump As, and Object Dumper sends the generated result to a new document, the Object Dumper output pane, or the clipboard.

Object Dumper is also available for:

Inspired by ObjectExporter.

Presentation

Features

Dump debugger objects in multiple formats

  • C# object initialization code
  • Visual Basic object initialization code
  • JSON
  • XML
  • YAML

Generate reusable code from runtime state

C# and Visual Basic output is powered by VarDump. See the VarDump documentation for supported formatting and traversal options.

Typical use cases include:

  • creating unit-test fixtures from real runtime objects
  • capturing complex DTOs or domain objects for bug reproduction
  • generating C# or Visual Basic initialization code
  • exporting debugger state to JSON or YAML
  • inspecting large object graphs without manually expanding every debugger node
  • comparing two runtime objects by dumping them into separate documents and using Visual Studio's file comparison tools

Multiple output destinations

Use Dump To to choose where generated content is written:

  • New Document
  • Output Window β†’ Object Dumper
  • Clipboard

Serialization, traversal, formatting, and output behavior can be configured under Tools β†’ Options β†’ Object Dumper.

Installation

Install Object Dumper from the Visual Studio Marketplace.

After installation, restart Visual Studio if prompted.

Usage

  1. Start debugging your .NET application.
  2. Stop at a breakpoint.
  3. Select an expression in the Code window, or enter/select an expression in the Immediate window.
  4. Right-click and open Dump As.
  5. Choose C#, Visual Basic, JSON, XML, or YAML.
  6. The generated output is sent to the destination configured by Dump To.

Configuration

Configure dump behavior under:

Tools β†’ Options β†’ Object Dumper

Object Dumper options page

Common defaults

Option Default
Max Depth 25
Operation Timeout 10 seconds
Dump To New Document

C# and Visual Basic settings correspond to VarDump options. Refer to the VarDump documentation for their behavior.

Changelog

See the changelog for release details and migration guidance.

IDE support

IDE Documentation
Visual Studio This page
Visual Studio Code VS Code README
JetBrains Rider Rider README

Quick tip: compare two dumped objects

Visual Studio can be used to compare two dumped object documents:

  1. Enable Show Miscellaneous Files in Solution Explorer.
  2. Dump both objects to separate documents.
  3. In Visual Studio 17.7 or later, select both files under Miscellaneous Files, right-click, and use the built-in comparison command.
  4. On older versions, install a diff extension such as Heku.VsDiff.

Show Miscellaneous Files

Compare Selected Files

Requirements

Supported Visual Studio versions:

  • Visual Studio 2019
  • Visual Studio 2022

Supported project languages:

  • C#
  • F#
  • Visual Basic

Supported serializer targets include:

  • .NET Framework 4.5+
  • .NET Standard 2.0+
  • .NET Core 2.0+
  • .NET 5+

Local debugging is currently required.

Known limitations and troubleshooting

Optimized code / Release builds

When debugging optimized code, external DLLs, or some NuGet package code, Visual Studio may report errors such as:

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

Use a Debug build when possible.

Alternatively enable:

Tools β†’ Options β†’ Debugging β†’ General β†’ Suppress JIT optimization on module load

See the Visual Studio documentation.

Remote debugging

Remote debugging is not currently supported.

Encoding issues

If generated documents contain encoding-related issues, enable:

Tools β†’ Options β†’ Environment β†’ Documents β†’ Save documents as Unicode when data cannot be saved in codepage

UWP applications

UWP does not support Assembly.LoadFrom, which prevents Object Dumper from injecting the serializer assembly automatically.

A workaround is to reference the .NET Standard 2.0 version of the Serialization library directly and preload it:

YellowFlavor.Serialization.ObjectSerializer.WarmUp();

See the UWP sample.

IIS-hosted ASP.NET MVC

When debugging an IIS-hosted ASP.NET MVC backend, the debugger process may require additional filesystem access.

Grant YourComputerName\IIS_IUSRS:

  • Read/Write access to %userprofile%\AppData\Local\Temp
  • Read access to %userprofile%\AppData\Local\Microsoft\VisualStudio

Otherwise Object Dumper may fail with UnauthorizedAccessException.

See issue #90.

Architecture

Object Dumper separates Visual Studio integration from its serializer layer:

  1. Visual Studio extension layer: Provides commands, menus, options, output destinations, and debugger integration.

  2. Debugger interaction: Evaluates the selected expression and loads the appropriate serializer into the debuggee.

  3. Shared serialization layer: Uses framework-specific YellowFlavor.Serialization.dll assemblies.

  4. Serialization libraries

    • VarDump for C# and Visual Basic
    • Json.NET for JSON and XML
    • YamlDotNet for YAML
  5. ILRepack: Bundles serializer dependencies into merged assemblies to reduce dependency conflicts with the debuggee.

Privacy

Object Dumper does not collect personal data.

Debugger interaction and serialization happen locally as part of your Visual Studio debugging session.

Powered by

Library Purpose License
VarDump C# and Visual Basic serialization Apache-2.0
Json.NET JSON and XML serialization MIT
YamlDotNet YAML serialization MIT
ILRepack Serializer dependency merging Apache-2.0

Contributing

Contributions, bug reports, and feature requests are welcome.

Support the project

If Object Dumper saves you time, you can support its continued development through:

License

Object Dumper is licensed under the MIT License.

About

A Visual Studio 2019-2026, Visual Studio Code and JetBrains Rider extension for exporting in-memory objects during debugging to C#, JSON, VB, XML, and YAML string.

Topics

Resources

Stars

115 stars

Watchers

5 watching

Forks

Sponsor this project

Packages

Used by

Contributors

Languages