BUG: Util.ToHtmlString repeats HTML header
Options
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:
<!DOCTYPE HTML>and
<body>
After the first body tag, you will immediately see the header repeated starting at line 207:
</head> <body><!DOCTYPE HTML> <html> <head>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)); }
Comments
-
Yes, this is a known problem that has been fixed in subsequent betas:
http://www.linqpad.net/download.aspx#beta -
Sorry to say that it has not been fixed in version 5.22.13.
Can you please include the fix?
reproduced by:Util.ToHtmlString("TEST").Dump()
-
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.
TryUtil.ToHtmlString("TEST")
or else switch to C# Statements and add a semi-colon.