I suggest you ...

Make Dump() extension method available in Visual Studio

Dump() extension method is #1 reason I love and use LinqPad.

It would be great if I could add LinqPad.exe as reference to my Visual Studio project and call Dump() extension method on any of my objects.

As Visual Studio does not have any window to display HTML we could have two variants to Dump() extension method

DumpHTML() which return output as HTMLtext and
DumpText() which returns the output as space formatted text in a ASCII Table

User may choose to print the output to the Console, Output Window or write to the disk.

I you think generating ASCII table is lot of work, I'm fine with HTML output as well.

Please please I need this feature added right now...

259 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
anunay shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Jared commented  ·   ·  Flag as inappropriate

    Peter - great recommendation. ServiceStack.Text is awesome!

  • Peter commented  ·   ·  Flag as inappropriate

    Why not nuget ServiceStack.Text and use that Dump method in VS

  • Anonymous commented  ·   ·  Flag as inappropriate

    hii... all i would like to compile .cs file with out mail function can any one provide solution for it.......thanq advance

  • Alex commented  ·   ·  Flag as inappropriate

    We created LinqPad nuget package for our dev group and tried to use Xhtml for the purpose of dumping entities during auditing and it works great, except there is a very big dependency from the whole LinqPad and Telerik has big performance issues in MVC project due to > ~500 types missing, so we have to switch to ObjectDumper class, so it would be beneficial if we could have render as Xhtml extracted into separate assembly or nuget package, happy to pay for that

  • Bent Rasmussen commented  ·   ·  Flag as inappropriate

    If this is your number one reason to use LINQPad, then it doesn't sound like a good reason for Joe to open-source it ;-)

  • Michael Nady commented  ·   ·  Flag as inappropriate

    I need it for another scenario, I am using a generic list of a runtime object that maps exactly to a database table. and i need to look for a specific value inside it.
    if you add linqPad as extension to visual studio, i can query this collection using linq (which is not permitted in the debugger!!), or i can dump its contents.

  • Tormod commented  ·   ·  Flag as inappropriate

    Yes, a dump method that returns formatted text resembling the output of LinqPad would be generally useful. If your problem is to get the code to compile within visual studio, just create your own stub.

  • Pat Kujawa commented  ·   ·  Flag as inappropriate

    Well, here's one way to use it:
    using System.Diagnostics;
    using System.IO;

    public static class Extensions
    /// <summary>
    /// Dumps to a temporary html file and opens in the browser.
    /// </summary>
    /// <param name="o">The object to display.</param>
    public static void Dump<T>(this T o)
    string localUrl = Path.GetTempFileName() + ".html";
    using (var writer = LINQPad.Util.CreateXhtmlWriter(true))
    File.WriteAllText(localUrl, writer.ToString());

  • Pat Kujawa commented  ·   ·  Flag as inappropriate

    Has anyone figured out how to get it to work when running unit tests? I am using Resharper's built-in testrunner, which has an HTML output window, but using CreateXhtmlWriter just dumps the HTML code (rather than rendering it).

  • o.chantosa commented  ·   ·  Flag as inappropriate

    how do you change the "maxDepth" when using the writer object created with CreateXhtmlWriter()? I am getting an "limit of graph" error in my output.

  • Pat Kujawa commented  ·   ·  Flag as inappropriate

    Another reason for creating a LINQPad DLL (preferably without all the extra resources) is so that ClickOnce deployments can work correctly. In my case, referencing LINQPad.exe worked for development (and, I assume, installations), but I would get the following error when trying to use it with a ClickOnce deployment:
    "Reference in the manifest does not match the identity of the downloaded assembly LINQPad.exe."

  • Pat Kujawa commented  ·   ·  Flag as inappropriate

    Using Joe and anunay's suggestions has worked well for me, but I notice that the resulting html doesn't include the javascript to allow expansion/shrinkage of different containers (a la LINQPad). I consider that ability very important, since it allows you to quickly focus on what you are interested in within the object. Is there a way to get this functionality into the Writer and for general use?

    Also, I was wondering if there could be a way to isolate the Dump functionality without having to reference all of LINQPad - doing so increased my MSI from 600K to about 3200K :-(

    Other than these issues, I am absolutely thrilled that I now have a quick, thorough tool for debugging/tracing!

  • anunay commented  ·   ·  Flag as inappropriate

    Hi Joe

    Thanks for exposing this functionally in the new Beta. Since I can't use Dump directly, I have created a new extension method Print as follows

    static class Extension
    public static string Print<T>(this T o)
    var writer = LINQPad.Util.CreateXhtmlWriter();
    return writer.ToString();

    To view contents of any variable during debugging, I simply add myVariable.Print() to the watch window and use Visual Studios build in HTML visualizer to see formatted XHTML.

    Thanks a ton

  • AdminJoe Albahari (LINQPad) (CEO / Founder, LINQPad) commented  ·   ·  Flag as inappropriate

    You can use LINQPad's XHTML Dump engine from within Visual Studio by adding a reference to LINQPad.exe and then doing this:

    var writer = LINQPad.Util.CreateXhtmlWriter();

    To call Dump(), simply call Write or WriteLine on the writer object.

    When you want to view the output. call ToString() on the writer - if you write the output to a file, you can then view it in a web browser.

  • anunay commented  ·   ·  Flag as inappropriate

    This works if your project is simple library or a console app. In my case the VS project I'm working on is huge with over 15+ references.The variables I want to dump exist in deep nested classes which can only be instantiated after multiple UI interaction setps. I just can't call my project from Linqpad without making some serious changes to it.

← Previous 1

Feedback and Knowledge Base