Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 How to replace large string variable with new XML while debugging

I am using Visual Studio 2010 and have a breakpoint set to stop execution of the app after a variable is set with contents of a large XML string. I want to replace the contents of the string with a different XML string. I open the Text Visualizer but it does not allow me to modify the string. How can I change the contents of the variable? I have the variable displayed in a Watch Window but only the first line of the string is copied.

like image 899
user31673 Avatar asked Nov 04 '22 17:11

user31673


1 Answers

My workaround for this:

  • Copy the text from Text Visualizer to notepad:

    <table xmlns="http://www.w3schools.com/furniture">
      <name>African Coffee Table</name>
      <width>80</width>
      <length>120</length>
    </table>
    
  • Edit the value according your needs:

    <table xmlns="http://www.w3schools.com/furniture">
      <name>African Coffee Table</name>
      <width>100</width>
      <length>200</length>
      <weight m="kilo">12</weight>
    </table>
    
  • Replace all " with "":

    <table xmlns=""http://www.w3schools.com/furniture"">
      <name>African Coffee Table</name>
      <width>100</width>
      <length>200</length>
      <weight m=""kilo"">12</weight>
    </table>
    
  • Open Immediate Window
  • Assign the new value to the variable using verbatim string literal @"", e.g.

    myXml=@"<table xmlns=""http://www.w3schools.com/furniture"">    <name>African Coffee Table</name>    <width>100</width>    <length>200</length>    <weight m=""kilo"">12</weight>  </table>"
    
like image 168
Slava Dolgov Avatar answered Nov 15 '22 06:11

Slava Dolgov