KGy SOFT Drawing Tools
The KGy SOFT Drawing Tools repository contains a couple of applications and some 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, manipulate and save them into various formats. Several modifications are possible such as rotating, resizing, changing pixel format with quantizing and dithering, adjusting brightness, contrast and gamma, or even editing the palette entries of indexed bitmaps.
Tip: As a developer, you can access all of these image manipulaion functions by using KGy SOFT Drawing Libraries. It supports not just
System.Drawingtypes but also completely managed and technology agnostic bitmap data manipulation as well.
KGy SOFT Imaging Tools supports localization from .resx files. New language resources can be generated for any languages, and you can edit the texts within the application. The changes can be applied on-the-fly, without exiting the application. If you switch to a right-to-left language, then the layout is also immediately applied (at least on Windows).
Tip: As a developer, you can use KGy SOFT Core Libraries if you want something similar in your application.
The edited resources are saved in .resx files in the
Resources subfolder of the application. Resources can be downloaded from within the application as well.
Note: If you create a localization for your language feel free to submit a new issue and I will make it available for everyone. Don't forget to mention your name in the translated About menu.
Help, my resources are gone!
If you use Imaging Tools as debugger visualizers, then it can be executed from various locations. See the bottom of the Troubleshooting section below.
Imaging Tools is packed with several debugger visualizers for Visual Studio (compatible with all versions starting with Visual Studio 2008, and supports even .NET Core 2.1 and newer platform targets). 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, then you can perform the install directly from Visual Studio by the Extensions/Manage Extensions (older Visual Studio versions: Tools/Extensions and Updates...) menu if you search for the "KGy SOFT Drawing DebuggerVisualizers" extension.
Alternatively, you can download the installer package from the VisualStudio Marketplace. There are two versions available:
- Download the binaries and extract the .7z archive to any folder.
- Open the folder with the extracted content. You will find four folders there:
net35contains the .NET Framework 3.5 version. Compatible with all Visual Studio versions starting with Visual Studio 2008 (tested with versions 2008-2019). Cannot be used to debug .NET Core applications.
net40contains the .NET Framework 4.0 version. You cannot use this one for Visual Studio 2008. Cannot be used to debug .NET Core applications.
net45contains the .NET Framework 4.5 version. You cannot use this one for Windows XP and Visual Studio 2008/2010. With some limitations supports also .NET Core/.NET projects (in case of issues see the Troubleshooting section).
net5.0-windowscontains the .NET 5.0 binaries of the Imaging Tools application. Debugger visualizers are not included because it would not be recognized by Visual Studio anyway.
KGySoft.Drawing.ImagingTools.exefrom one of the folders listed above. Click the Manage Debugger Visualizer Installations... button (the gear icon) on the toolbar.
Note: Starting with version 2.1.0 the debugger visualizers can be used also for .NET Core projects from Visual Studio 2019, even though no .NET Core binaries are used.
- 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.
|An unhandled exception of type 'System.InvalidOperationException' was thrown by the custom visualizer component in the process being debugged. (Object is currently in use elsewhere.)
||You try to debug a
|The target process exited with code -2146233082 (0x80131506) while evaluating the function 'System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode'.
||Occurs in Visual Studio 2022 when attempting to debug a
The bug has been reported to the VisualStudio team.
|Unable to perform function evaluation on the process being debugged (Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.)
||Can occur even with debug build, typically when debugging a .NET Core project. When it happens, then likely all members in the debug window show a similar error message. Perform a Step Over operation (F10 by default)/Set Next Statement (Ctrl+Shift+F10), or restart the debugging session and try again.|
|Unable to perform function evaluation on the process being debugged (Function evaluation timed out)
||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. If all members in the debug window show an error, then perform a Step Over operation first (F10 by default).|
|Unable to load the custom visualizer (Operation is not valid due to the current state of the object)
||Typically happens after timeout. Likely all members in the debug window show a similar error message. Perform a Step Over operation (F10 by default)/Set Next Statement (Ctrl+Shift+F10), or restart the debugging session and try again.|
|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.
The bug has been reported to the VisualStudio team.
• Occurs in Visual Studio 2019 also when replacing a
The bug has been reported to the VisualStudio team.
|The Color visualizer appears in read-only, even though the debugged value is in a read-write context (eg. local variable).
||Occurs with some specific builds of Visual Studio 2019
The bug has been reported to the VisualStudio team as part of another issue.
|Unable to load the custom visualizer. (Exception of type 'System.Exception' was thrown)
||Occurs when you debug a project that targets .NET Framework 3.5 or earlier versions. You can either target at least .NET Framework 4.0 (at least temporarily, for debugging), or you can manually install the .NET Framework 3.5 version of the Debugger Visualizers (which cannot be used to debug the .NET Core targets, though).|
|Unable to load the custom visualizer. (The debuggee-side visualizer assembly 'KGySoft.Drawing.DebuggerVisualizers, Version=[...]' was not found at path '<Documents>\Visual Studio <version>\Visualizers\netstandard2.0'.)
||Occurs when you try to debug a .NET Core project with the .NET Framework 3.5/4.0 builds installed. To debug .NET Core projects you need to install the .NET Framework 4.5 version.|
|An unhandled exception of type 'System.TypeInitializationException' was thrown by the custom visualizer component in the process being debugged. (The type initializer for 'KGySoft.CoreLibraries.XXXX' threw an exception.)
||Occurs when you try to debug a .NET Core project while the .NET Framework 3.5 binaries of the debugger visualizers are deployed in the
|An unhandled exception of type 'System.IO.FileLoadException' was thrown by the custom visualizer component in the process being debugged. (Could not load file or assembly 'KGySoft.CoreLibraries / KGySoft.Drawing, Version=####'.)
||If you debug a .NET Core project that also references KGySoft assemblies, then the versions referenced by the debugger visualizers and your project must match; otherwise, you get this error. If the version in the message is higher than the one your project references, then simply upgrade the references of your project. Otherwise, as the issue does not occur when targeting .NET Framework, you can try to change the targeted framework in the .csproj file for the debugging.|
|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.|
|An unhandled exception of type 'System.TypeLoadException' / 'System.MissingMethodException' was thrown by the custom visualizer component in the process being debugged.
||You are probably debugging a .NET Core 2.0 application referencing the
|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').
|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.|
|The app looks blurry.||If you changed the DPI settins, you need to restart the application. Per-monitor DPI awareness is not supported.|
|The visual elements are scaled incorrectly.
||May happen if you use Imaging Tools from debugger visualizers, and you have just changed the DPI settings without signing out/in. However, signing in and out is not required if you execute the app directly.|
|I edited the language resource files but I cannot find them (or they appear to be gone)||The Visual Studio/Tools/KGy SOFT Drawing Debugger Visualizers and clicking the magnifier icon executes the Imaging Tools from different locations. If you edit the language resources at one place they will not be automatically applied at the other place. Therefore, the saved resources might be at different possible locations:
• If you execute a manually deployed version the resources will be in a
• During debugging the tool is executed from the debugger visualizers folder:
• If you launch the tool from the Visual Studio Tools menu, then it is located under
Tip: See above how to download the debugger visualizer installers
You can download the sources and the binaries as .7z/.zip archives at the releases page.
To support the widest possible range of platforms the binaries archive contains multiple builds in different folders.
net35: This contains the .NET Framework 3.5 build and though it works on every platforms Imaging Tools supports, it is not really recommended to use as a standalone application. If you use Imaging Tools as debugger visualizers, then it is the only version you can use for Visual Studio 2008. For newer Visual Studio versions use it only if you want to debug a .NET Framework 2.0-3.5 application.
net40: This is the .NET Framework 4.0 build. As a standalone application, it's basically recommended only for Windows XP.
net45: This is the .NET Framework 4.5 build, which is the recommended version to use as a debugger visualizer for .NET Framework 4.x and .NET Core projects (including .NET 5 and newer platforms). As a standalone application, this is also the recommended version for Linux (though 3.5/4.0 also support it).
net5.0-windows: This folder contains the .NET 5.0 build. As a standalone application this is the recommended version for Windows 7 and above. On the other hand, this one cannot be used as a debugger visualizer (even for .NET Core projects) and does not support Linux either.
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 how to use the public API of the Imaging Tools application and the DebuggerVisualizers from a consumer library or application.
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 2022).
See the change log.
This repository is under the KGy SOFT License 1.0, which is a permissive GPL-like license. 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: though you are free to change and re-use anything, do that by giving appropriate credit. See the LICENSE file for details.