Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I use my own debugger visualiser to edit variables runtime?
    primarykey
    data
    text
    <p>I'm writing my own debugger visualiser. All works great to show up to visualiser with the data.</p> <p>Now I add the code for more clearness:</p> <pre><code>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); } } } </code></pre> <p>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.</p> <p>How do I do that?</p> <p><strong>Edit:</strong></p> <p>I found out that I need to override the <code>TransferData</code> method in <code>VisualizerObjectSource</code>. But in the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.debuggervisualizers.visualizerobjectsource.transferdata%28v=vs.80%29.aspx" rel="nofollow">MSDN</a> is no detail information about how I implement this correctly.</p> <p>Can someone help me please?</p> <p><strong>Edit 2:</strong></p> <p>I looked with IL-Spy what <code>TransferData</code> method does. It throws an exception. So I override the method. But it is still not working. In the <code>incomingData</code> is the modified string from the <code>Form</code>. But I do not get back this value into the variable :(</p> <pre><code>public class StringVisualiserObjectSource : VisualizerObjectSource { public override void GetData(object target, Stream outgoingData) { var data = target as string; var writer = new StreamWriter(outgoingData); writer.Write(data); writer.Flush(); } public override void TransferData(object target, Stream incomingData, Stream outgoingData) { incomingData.CopyTo(outgoingData); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload