Condividi tramite


VisualizerTarget.StateChanged Event

Definition

Occurs when the state of the visualizer target changes. The event argument specifies the type of the state change.

public event Microsoft.VisualStudio.Threading.AsyncEventHandler<Microsoft.VisualStudio.RpcContracts.DebuggerVisualizers.VisualizerTargetStateNotification>? StateChanged;
member this.StateChanged : Microsoft.VisualStudio.Threading.AsyncEventHandler<Microsoft.VisualStudio.RpcContracts.DebuggerVisualizers.VisualizerTargetStateNotification> 
Public Event StateChanged As AsyncEventHandler(Of VisualizerTargetStateNotification) 

Event Type

Remarks

This event is only useful when implementing a debugger visualizer with Style being ToolWindow. This is because modal visualizers prevent the user to unpause the debug session while they are open resulting in the state of the VisualizerTarget always being Available and the visualized value never changing for the entire lifetime of the modal visualizer.

Possible notifications include:

  • Changes of availability: the visualizer target is only available when the debug session is active and the debug target is paused. When the visualizer target is not available, calls to ObjectSource methods will fail with a VisualizerTargetUnavailableException. When the debugger object provider becomes available again, the value of the target object should be considered outdated and should be retrieved again.
  • Notifications that the value of the target object may have changed and should be retrieved again.

When handling this event, any retrieval of the new value of the target object and update to the data context of the IRemoteUserControl should be completed before returning from the event handler.

Subscribe to this event from within CreateVisualizerAsync(VisualizerTarget, CancellationToken) to guarantee that all notifications, including the initial state of the visualizer target, are received.

Applies to