Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 3.07 KB

create-custom-views-of-managed-objects.md

File metadata and controls

52 lines (41 loc) · 3.07 KB
titledescriptionms.datems.topicf1_keywordsdev_langshelpviewer_keywordsauthorms.authormanagerms.subservice
Create custom views of .NET objects
Visual Studio debugger displays data in its variable windows. Learn to customize how data types—including custom types—are displayed.
08/08/2023
conceptual
vs.debug.data.elements
CSharp
VB
FSharp
C++
data types, custom
custom data types
managed code, custom data types
autoexp.dat file
mcee_cs.dat file
debugger, expanding data types
mcee_mc.dat file
mikejo5000
mikejo
mijacobs
debug-diagnostics

Create custom views of .NET objects (C#, Visual Basic, F#, C++/CLI)

You can customize the way Visual Studio displays data types in debugger variable windows.

Attributes

In C#, Visual Basic, F#, and C++ (C++/CLI code only), you can add expansions for custom data using xref:System.Diagnostics.DebuggerDisplayAttribute, xref:System.Diagnostics.DebuggerTypeProxyAttribute, and xref:System.Diagnostics.DebuggerBrowsableAttribute.

In .NET Framework 2.0 code, Visual Basic doesn't support the DebuggerBrowsable attribute. This limitation is removed in more recent versions of .NET.

Visualizers

There are two options to create a visualizer for a .NET type:

  • Using the VisualStudio.Extensibility SDK: Starting in Visual Studio 2022 version 17.9, Visual Studio ships a new way to create custom visualizers that offers, among other things, simple extension installation, and the ability to target newer versions of .NET. This option is the recommended API, except in cases where the visualizer and the visualized type should ship together, or in cases where an older version of Visual Studio needs to be supported. For more information, see Create Visual Studio debugger visualizers.
  • Using Microsoft.VisualStudio.DebuggerVisualizers.DialogDebuggerVisualizer: For more information on this approach, see Custom visualizers.

Note

To create a visualizer for C/C++ objects, see UIVisualizer element within the Natvis documentation. Also, see the C/C++ custom visualizer sample or the SQLite native Debugger Visualizer sample.

Related content

close