Share via


IVisualizerObjectProvider Interface

Definition

Provides object data from the debuggee to the visualizer.

public interface class IVisualizerObjectProvider
public interface class IVisualizerObjectProvider
__interface IVisualizerObjectProvider
public interface IVisualizerObjectProvider
type IVisualizerObjectProvider = interface
Public Interface IVisualizerObjectProvider
Derived

Examples

public class DebuggerSide : DialogDebuggerVisualizer  
{  
    override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
    {
         MessageBox.Show(objectProvider.GetObject<object>().ToString());
    }
    // . . . Other methods omitted for clarity.  
}

Remarks

A visualizer is a small program the Visual Studio debugger uses to display (visualize) an object of a specific data type in meaningful manner. To visualize an object, a visualizer uses code that runs in the debugger process (the debugger side) and code in the process being debugged (the debuggee side).

The debugger side and debuggee side communicate with each other by using VisualizerObjectSource and IVisualizerObjectProvider.

The debuggee side uses VisualizerObjectSource to specify a VisualizerObjectSource object for the debugger side. The debugger side requests and receives this information by calling methods on the IVisualizerObjectProvider interface.

A visualizer can edit, as well as display, data. If your visualizer supports editing data, you must replace the data entirely by calling ReplaceData(Stream) or ReplaceObject(Object) or transfer data back to the debuggee using TransferData(Stream) or TransferObject(Object). If you want to save data back, you also need to create your own object source.

Properties

IsBinaryFormatterSupported

Specifies if the debuggee supports the BinaryFormatter since it was deprecated in .NET 5. If it does not, the provider most use JSON to communicate with the visualizer.

IsObjectReplaceable

Specifies whether a replacement object can be created. That is, determines whether the data object being visualized is replaceable (read/write) or nonreplaceable (read only).

Methods

GetData()

Gets an initial blob of data about the object being debugged. The data is written into the provided MemoryStream.

GetObject()
Obsolete.

Gets the data using GetData and then deserializes assuming that default serialization has been done

ReplaceData(Stream)

Creates a replacement copy of the object based on the serialized data given.

ReplaceObject(Object)

Serializes the object using default serialization and then sets the data using ReplaceData

TransferData(Stream)

Transfers the data bidirectionally to the TransferData method on the VisualizerObjectSource

TransferObject(Object)
Obsolete.

Serializes the outgoing object using default serialization and then calls TransferData. Upon return deserializes the incoming data and returns the deserialized object

Applies to