title: Show a seq in the watch window
body: <p>Is there any way to get Visual Studio debugger to display the contents of an F# <code>seq</code> expression?</p>
  
  <p>Visual Studio knows about <code>IEnumerable&lt;T&gt;</code> objects and gives you a results view inside the watch window. If you look at one of these in the watch window you get a mess of private fields.</p>
  
  <p>Some potential alternatives:</p>
  
  <ul>
  <li><em>fsi.exe</em> does a nice job of printing sequences, but it doesn't interact with the debugger</li>
  <li>Find a way to call <code>Seq.toArray</code> from inside the debugger. I can't find the right syntax to invoke this from, say, the Immediate window.</li>
  <li>Write a vizualiser. I don't know if it's possible to attach vizualisers to Microsoft types.</li>
  <li>Something else...?</li>
  </ul>
  
  <p><strong>Edit:</strong> Further investigation reveals that F#'s <code>seq</code> objects implement <code>IEnumerable&lt;T&gt;</code> just fine -- they appear in the watch window as such -- but for some reason the results view doesn't appear.</p>
  
  <p><strike>However, F# <code>seq</code> objects don't seem to be plain IEnumerables; instead, they look to be closures coming from the functions inside the <code>Seq</code> module.</strike> (F# <code>seq</code> objects look to be instances created using <code>{ new IEnumerable with ... }</code>.) </p>