KGy SOFT Drawing Tools
KGy SOFT Drawing Tools repository contains Debugger Visualizers for several
System.Drawing types such as
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.
Table of Contents
- KGy SOFT Imaging Tools
- Debugger Visualizers
- Release Notes
- Debugger Visualizers Test Tool
KGy SOFT Imaging Tools
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.
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.
Either click the magnifier icon or choose a debugger visualizer from the drop down list (if more visualizers are applicable).
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
System.Drawing.Bitmap: Supports multi-page, multi-resolution and animated
Bitmapinstances. 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.
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.
- Download the binaries and extract the .zip file to any folder.
- Open the folder with the extracted content. You will find three folders there:
NET35contains the .NET 3.5 version. Compatible with all Visual Studio versions starting with Visual Studio 2008 (tested with versions 2008-2019).
NET40contains the .NET 4.0 version. You cannot use this one for Visual Studio 2008.
NET45contains the .NET 4.5 version. You cannot use this one for Windows XP and Visual Studio 2008/2010.
KGySoft.Drawing.ImagingTools.exefrom one of the folders listed above. Click the Manage Debugger Visualizer Installations... button (the gear icon) on the toolbar.
- 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.
- Click on the Install button. On success the status will display the installed version.
If Visual Studio cannot load the visualizer or you have other debugger visualizer related problems check this table.
|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.
||Open Debug / Options / Debugging / General and make sure that both Use Managed Compatibility Mode and Use legacy C# and VB expression evaluators are unchecked.
|Unable to load the custom visualizer (serializer could not be resolved).
||The project you debug references an unmatching version of the
|Unable to load the custom visualizer (The UI-side visualizer type must derive from 'DialogDebuggerVisualizer').
|Object is currently in use elsewhere.
||You try to debug a
|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
|An unhandled exception of type 'System.NullReferenceException' was thrown by the custom visualizer component in the process being debugged.
||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.
||Occurs when you clear the debugged image in Visual Studio 2017, which does not support nullifying the debugged value.|
|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'.
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.
||Windows XP does not support the .NET 4.5 version.|
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
Note: The Debugger Visualizers Test Tool directly references a specific version of the
Microsoft.VisualStudio.DebuggerVisualizersassembly, therefore Visual Studio will not able to display visualizers when debugging this project unless you use the very same version (Visual Studio 2013).
See the change log.
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.