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:
<!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
http://www.linqpad.net/download.aspx#beta
Can you please include the fix?
reproduced by:
Util.ToHtmlString("TEST").Dump()
Are you trying to remove the header entirely? In which case you want this:
Util.ToHtmlString(true, true, "TEST")
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.