BUG: Util.ToHtmlString repeats HTML header

In LinqPad 5.08.01, any use of ToHtmlString or CreateXhtmlWriter+Write causes the resulting HTML to contain a repeat of all content between

After the first body tag, you will immediately see the header repeated starting at line 207:
To reproduce, run this C# program query and inspect the output file.
void Main()
	var a = new { Hello = "Hello" };
	System.IO.File.WriteAllText(Environment.ExpandEnvironmentVariables("%HOMEPATH%\\Documents\\Linqtest.html"), Util.ToHtmlString(a));


  • Yes, this is a known problem that has been fixed in subsequent betas:

  • Sorry to say that it has not been fixed in version 5.22.13.

    Can you please include the fix?

    reproduced by:
  • I've just tried it and it works fine. The header appears just once.

    Are you trying to remove the header entirely? In which case you want this:

    Util.ToHtmlString(true, true, "TEST")
  • If you are typing Util.ToHtmlString("TEST").Dump() , (without the semi-colon), then you are probably in C# Expression mode which means your don't need to add the .Dump() or you will end up dumping twice.

    Try Util.ToHtmlString("TEST") or else switch to C# Statements and add a semi-colon.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!