Skip to content
Debugger visualizers and apps built on KGy SOFT Drawing Libraries
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
KGySoft.Drawing.DebuggerVisualizers.Package
KGySoft.Drawing.DebuggerVisualizers.Test
KGySoft.Drawing.DebuggerVisualizers
KGySoft.Drawing.ImagingTools
.gitignore
KGySoft.Drawing.Tools.sln
KGySoft.snk
LICENSE
README.md
changelog.txt
nuget.config

README.md

KGy SOFT .net

KGy SOFT Drawing Tools

KGy SOFT Drawing Tools repository contains Debugger Visualizers for several System.Drawing types such as Bitmap, Metafile, Icon, BitmapData, Graphics, etc. (see also below). The visualizers use KGy SOFT Imaging Tools to display these types visually, which can be executed as a standalone application as well. Along with the Debugger Visualizers Test Tool it can be considered also as a demonstration of the features of the KGy SOFT Drawing Libraries.

Website Drawing Libraries Repo

Table of Contents

  1. KGy SOFT Imaging Tools
  2. Debugger Visualizers
  3. Download
  4. Release Notes
  5. Debugger Visualizers Test Tool
  6. License

KGy SOFT Imaging Tools

KGySoft.Drawing.ImagingTools

The Imaging Tools application makes possible to load images and icons from file, provides detailed information about images and you can convert them to other formats.

Debugger Visualizers

Imaging Tools is packed with several debugger visualizers for Visual Studio (compatible with all versions starting with Visual Studio 2008). When a type is debugged in Visual Studio and there is a debugger visualizer installed for that type, then a magnifier icon appears that you can click to open the visualizer.

Debugger Visualizer Usage

Either click the magnifier icon or choose a debugger visualizer from the drop down list (if more visualizers are applicable).

Debugging Graphics

The KGySoft.Drawing.DebuggerVisualizers assembly provides debugger visualizers for the following types:

  • System.Drawing.Image: If executed for a non read-only variable or member of type Image, then the actual value can be replaced by any Bitmap or Metafile.
  • System.Drawing.Bitmap: Supports multi-page, multi-resolution and animated Bitmap instances. The bitmap can be saved in many formats. In a non read-only context the bitmap can be replaced from file and its palette (for indexed bitmaps) can be edited.
  • System.Drawing.Imaging.Metafile: Unlike many image debugger visualizers around the net, this one does not transform the metafile into a low-resolution PNG image because it is able to serialize the actual metafile content. The metafile can be saved into EMF/WMF formats. In a non read-only context the image can be replaced from file.
  • System.Drawing.Icon: Supports compound and huge icons even in Windows XP. The icon can be saved, and in a non read-only context it can be replaced from file.
  • System.Drawing.Imaging.BitmapData: Even for indexed data; however, the palette information cannot be retrieved.
  • System.Drawing.Graphics: Supports both image and native window graphics.
  • System.Drawing.Imaging.ColorPalette: In a non read-only context the colors can be edited.
  • System.Drawing.Color: In a non read-only context the color can be replaced.

Debugging Palette

Installing Debugger Visualizers

By VSIX Installer

If you use Visual Studio 2013 or newer the simplest way is to download the installer package from the VisualStudio Marketplace.

You can perform the install also from Visual Studio by the Tools/Extensions and Updates... (Visual Studio 2019: Extensions/Manage Extensions) menu if you search for the "KGy SOFT Drawing DebuggerVisualizers" extension.

Manual Install

  1. Download the binaries and extract the .zip file to any folder.
  2. Open the folder with the extracted content. You will find three folders there:
  • NET35 contains the .NET 3.5 version. Compatible with all Visual Studio versions starting with Visual Studio 2008 (tested with versions 2008-2019).
  • NET40 contains the .NET 4.0 version. You cannot use this one for Visual Studio 2008.
  • NET45 contains the .NET 4.5 version. You cannot use this one for Windows XP and Visual Studio 2008/2010.
  1. Execute KGySoft.Drawing.ImagingTools.exe from one of the folders listed above. Click the Manage Debugger Visualizer Installations... button (the gear icon) on the toolbar.

Select Install

  1. In the drop down list you will see the identified Visual Studio versions in your Documents folder. You can select either one of them or the <Custom Path...> menu item to install the visualizer debuggers into a custom folder.

Select Visual Studio version

  1. Click on the Install button. On success the status will display the installed version.

Installation Complete

Troubleshooting

If Visual Studio cannot load the visualizer or you have other debugger visualizer related problems check this table.

Issue Solution
The magnifier icon does not appear Debugger Visualizers are not installed for the Visual Studio version you use. Check the installation steps above. Make sure you select the correct version from the list.
Could not load this custom viewer.
Could not load this custom viewer.
Open Debug / Options / Debugging / General and make sure that both Use Managed Compatibility Mode and Use legacy C# and VB expression evaluators are unchecked.
Debugging Options.
Unable to load the custom visualizer (serializer could not be resolved).
Unable to load the custom visualizer (serializer could not be resolved).
The project you debug references an unmatching version of the Microsoft.VisualStudio.DebuggerVisualizers to your actual VisualStudio version.
Unable to load the custom visualizer (The UI-side visualizer type must derive from 'DialogDebuggerVisualizer').
Unable to load the custom visualizer (The UI-side visualizer type must derive from 'DialogDebuggerVisualizer').
The Microsoft.VisualStudio.DebuggerVisualizers.dll has been copied to the debugger visualizers installation folder. Recent Visual Studio versions can handle if a debugger visualizer references an unmatching version of this assembly but only if this assembly is not deployed along with the visualizers.
Object is currently in use elsewhere.
Object is currently in use elsewhere.
You try to debug a Graphics instance, whose Device Context is in use (the GetHdc method has been called previously). This Graphics instance cannot be accessed until the ReleaseHdc method is called.
Function evaluation timed out On slower computers with a slower Visual Studio (with many add-ons, for example) it can happen that the visualizer loads too slowly for the first time. Just try to click the magnifier icon again, which usually solves the problem. Alternatively, you can try to set a DWORD value in the Registry under the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\[version]\Debugger key, called LocalsTimeout. The value represents milliseconds.
An unhandled exception of type 'System.NullReferenceException' was thrown by the custom visualizer component in the process being debugged.
An unhandled exception of type 'System.Exception' was thrown by the UI-side custom visualizer component.
Occurs when you clear the debugged image in Visual Studio 2019, which does not support nullifying the debugged value.
An unhandled exception of type 'System.Exception' was thrown by the UI-side custom visualizer component.
An unhandled exception of type 'System.Exception' was thrown by the UI-side custom visualizer component.
Occurs when you clear the debugged image in Visual Studio 2017, which does not support nullifying the debugged value.
Could not evaluate expression.
Could not evaluate expression.
Occurs when you clear the debugged image in Visual Studio 2015, which does not support nullifying the debugged value.
Could not load file or assembly 'KGySoft.Drawing.DebuggerVisualizers.dll'.
Could not load file or assembly 'KGySoft.Drawing.DebuggerVisualizers.dll'. or one of its dependencies.
Visual Studio 2008 supports the .NET 3.5 version only. A similar error may occur even if some files are missing. Just install a correct version again.
Value does not fall within the expected range.
Value does not fall within the expected range.
Windows XP does not support the .NET 4.5 version.

Download

You can download the sources and the binaries as .zip archives here.

Debugger Visualizers Test Tool

A simple test application is also available in the download binaries. Though it was created mainly for testing purposes it also demonstrates the debugger visualizer and some KGySoft.Drawing features. If you are interested in using KGy SOFT Drawing Libraries (and KGy SOFT Core Libraries) as a developer, then it may worth checking its source code (especially the DebuggerTestFormViewModel class).

Debugger Visualizer Test App

Note: The Debugger Visualizers Test Tool directly references a specific version of the Microsoft.VisualStudio.DebuggerVisualizers assembly, therefore Visual Studio will not able to display visualizers when debugging this project unless you use the very same version (Visual Studio 2013).

Release Notes

See the change log.

License

This repository is under the CC BY-ND 4.0 license (see a short summary here). It allows you to copy and redistribute the material in any medium or format for any purpose, even commercially. The only thing is not allowed is to distribute a modified material as yours.

You can’t perform that action at this time.