How do I use my own debugger visualiser to edit variables runtime?

Posted by C Sharper on Stack Overflow See other posts from Stack Overflow or by C Sharper
Published on 2012-11-17T13:11:11Z Indexed on 2012/11/27 11:04 UTC
Read the original article Hit count: 253

Filed under:
|

I'm writing my own debugger visualiser. All works great to show up to visualiser with the data.

Now I add the code for more clearness:

public class MyVisualiserObjectSource : VisualizerObjectSource
{
    public override void GetData(object target, Stream outgoingData)
    {
        string data= target as string;
        var writer = new StreamWriter(outgoingData);
        writer.Write(data);
        writer.Flush();
    }    
}

public class MyVirtualizer : DialogDebuggerVisualizer
{
    protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
    {
        var streamReader = new StreamReader(objectProvider.GetData());

        string data = streamReader.ReadToEnd();

        using (var form = new MyVirtualizerForm(data))
        {
            windowService.ShowDialog(form);


        }

    }
}

The string here is passed to the visualizer and show my own form. It works. But now I want to pass back the modified data from the form to the variable.

How do I do that?

Edit:

I found out that I need to override the TransferData method in VisualizerObjectSource. But in the MSDN is no detail information about how I implement this correctly.

Can someone help me please?

© Stack Overflow or respective owner

Related posts about c#

Related posts about debuggervisualizer