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