Visual Dump
This extension allows you to view a visual dump of your objects during the debugging of the program in Visual Studio
Simply open Visual Dump
window from View => Other Windows
and call .Dump()
with object you need during debugging!
Prehistory
The debugging process is one of the most important development processes and the ability to view visual interpretation of objects is an essential part of modern debugging.
I believe that Visual Dump
is able to make it easier and clearer!
How often does Visual Studio render your objects in the Watch/Locals/etc windows in the different way you wanted?
Have you never wanted to view the state of objects in a more visual form?
Have you never wanted to easily change the process of how your objects are rendered?
Personally, I do
Once I met a wonderful 'LINQPad' by Joseph Albahari I just fell in love with the Dump
function! Enjoying her flexibility and beauty, I caught myself thinking that I wanted to see something similar in Visual Studio
And I did it!
So proud to present you the Visual Dump
extension!
Examples
Visual Dump
is really simple to use!
- Open your Visual Studio
- Open
Visual Dump
window from View => Other Windows
- Open project you need
- Add a call to the
.Dump()
function where it's necessary
- Run your project
- Enjoy!)
If you need to disable the dumping, you don't need to delete all .Dump()
calls: just call DumpExtensions.DisableDumping()
and each .Dump()
will start simply returning the same object it received without any side effects!
Let's dump something:
Matrix 10x10 (Visual Studio
vs Visual Dump
)
Chain dumping
As you can see, .Dump()
returns the same object that it received, so it can be used with objects like StringBuilder
or in those places where the functional approach is used (etc)
Also in order not to lose an object among other dumps, you can set a header for it by passing the necessary string parameter to .Dump()
!
If the visual dump takes up too much screen space, you can minimize it by clicking the arrow in the table's header
Reorganization of elements in an array
For example, we have an array of some elements whose dump looks like this:
We can rebuild them into a more compact form: just click on the pickaxe icon (to return everything as it was, click on it again):
Dynamic dumping
Feel free to use .Dump()
inside Immediate/Watch and similar windows:
Themes
Visual Dump
has 2 themes:
Dessader Theme (In honor of my friend who helped me with it and package's icon)
Dark
Light
LINQPad Theme (For those who are used to LINQpad)
Dark
Light
You can simply select theme you like using options window:
(If Auto clear
is active, Visual Dump
window we'll be automatically cleared when starting a new project)
How can I provide my own dumping rule?
This is much easier than you might think! Just follow these simple steps:
- Define some class and inherit it from
HTMLProvider
- Mark your class with
ExportHTMLProviderAttribute
, specifying the type for which you want to apply your dumping rule
- Override method
ToHTML
:
object Obj
is object passed for dumping
Stack<object> CallStack
is dumping stack. If you need to call another dumping providers, you must push current object to cloned stack and pass it to next ToHTML method
objetc[] Args
- arguments from user code (do whatever you want with them)
So, we'll get something like this as result:
Compatible with
Currently Visual Dump
is compatible with any .NET language and platform:
- .NET Framework 4.5+ (
C#
, F#
, Visual Basic
)
- .NET Core 2.0+ (
C#
, F#
, Visual Basic
)
- .NET Standart 2.0+ (
C#
, F#
, Visual Basic
)
Snippets
Visual Dump
supplies several snippets for your convenience:
C#
didebug
- Inserts code that activates Dumping only with DEBUG:
#if !DEBUG
DumpExtensions.DisableDumping();
#endif
direlease
- Inserts code that activates Dumping only with RELEASE:
#if DEBUG
DumpExtensions.DisableDumping();
#endif
Visual Basic
DIDEBUG
- Inserts code that activates Dumping only with DEBUG:
#If !DEBUG
DumpExtensions.DisableDumping()
#End If
DIRELEASE
- Inserts code that activates Dumping only with RELEASE:
#If DEBUG
DumpExtensions.DisableDumping()
#End If
F#
Microsoft, where is the support for snippets for F#
?
Changes
- 1.0 - Initial release
- 2.0 - Some cool improves:
- You no longer need to call
DumpExtensions.EnableDumping()
to activate Dumping! (#4)
- Fixed
IOException: The semaphore timeout period has expired
during some calls to DumpExtensions
Visual Dump
initialization is much faster now!
- Fixed Visual Studio 2019 installation exception (#2)
- 2.1 - Now all my extensions work on the basis of a single API, which made it possible to simplify some things