title: How can I get the DisplayString field from Debugger.GetExpression?
body: <h3>Background</h3>
  <p>I'm writing a Visual Studio Extension in C# that executes code in the Immediate Window while debugging another application. The expression returns a value that can be a int, a string literal, a class, etc. The application that I'm debugging is written in C++.</p>
  <h3>The code</h3>
  <p>To execute the Immediate Window commands I use this line of code:</p>
  <pre><code>var expression = dte.Debugger.GetExpression(&quot;funcname()&quot;);
  </code></pre>
  <p>And to retrieve the result I use:</p>
  <pre><code>string val = expression.Value;
  </code></pre>
  <p>and:</p>
  <pre><code>var children = expression.DataMembers;
  </code></pre>
  <p>Here is myFunc() in the application I'm debugging:</p>
  <pre><code>std::vector&lt;int&gt; myFunc()
  {
      return { 1, 2, 3, 4, 5 };
  }
  </code></pre>
  <h3>The problem</h3>
  <p>When I manually run the expression in the Immediate Window, the returned object is dumped as I see it in the Watch Window (<a href="https://i.stack.imgur.com/J94Ek.png" rel="nofollow noreferrer">see here</a>). I managed to find all the children names, but the values are missing (<a href="https://i.stack.imgur.com/jzWg8.png" rel="nofollow noreferrer">see here</a>).</p>
  <p>What I want is to achieve the DisplayString (<code>{ size=5 }</code>), but I haven't found anything useful yet.</p>
  <p><strong>How can I get the DisplayString field from Debugger.GetExpression?</strong></p>
  <p><strong>EDIT: I don’t have to use this API. If you know another way that can return this sting, please suggest it. One idea could be retrieving the full output string of the Immediate Window (<a href="https://i.stack.imgur.com/J94Ek.png" rel="nofollow noreferrer">see the right side</a>), and then parsing it.</strong></p>
  <p><strong>EDIT2: <a href="https://streamable.com/09agd0" rel="nofollow noreferrer">See this video that better explains the issue</a></strong></p>