Settings and activity
3 results found
-
24 votesPat Kujawa supported this idea ·
An error occurred while saving the comment -
276 votes
An error occurred while saving the comment Pat Kujawa commentedWell, 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))
{
writer.Write(o);
File.WriteAllText(localUrl, writer.ToString());
}
Process.Start(localUrl);
}
}An error occurred while saving the comment Pat Kujawa commentedHas 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).
An error occurred while saving the comment Pat Kujawa commentedAnother 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 supported this idea ·An error occurred while saving the comment Pat Kujawa commentedUsing 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!
-
338 votesPat Kujawa supported this idea ·
Yes, it would be great to customize this particular behavior. It really bugs me to have a space before parentheses when I'm invoking a function. A space after if, using, while, etc makes sense, but please don't put one after a function. (Interestingly, when you open up a C# Program query, the main method is written *without* the annoying space, viz. void Main().)