Home
Options

LINQPad.Runtime

Here's the executive summary: The XhtmlWriterr recovered from Util.CreateXhtmlWriter() produces different table HTML when used in the LINQPad application and when using the LINQPad.Runtime. Specifically, in the application thead and tbody tags are created and used properly, but not when using LINQPad.Runtime. This is a real problem when you need to alter the generated output, for example using AgilityPackHtml, because elements of interest have different XPath locations. I'm using LINQPad 8 and LINQPad.Runtime (7.8.7) from Nuget and the LINQPad8.Runtime (8.0.1.0) dll from the x64 installation of the application.

Here's the long version: This sample query is C# program that creates a simple table and writes to the XhtmlWriter.
void Main()
{
List simpleTest = new()
{
new SimpleTest("One", "Two"),
new SimpleTest("Buckle", "My shoe"),
new SimpleTest("Three", "Four"),
new SimpleTest("Shut", "The Door"),
new SimpleTest("Five", "Six"),
new SimpleTest("Pickup", "Sticks")
};

string html = string.Empty;
using (TextWriter writer = Util.CreateXhtmlWriter())
{
    writer.Write(simpleTest);
    html = writer.ToString();
}

File.WriteAllText(@"D:\Temp\junk\Testing Table Generation\lpSimpleTest.html", html);

}

public record SimpleTest(string Hello, string Goodbye)
{
}

There are no additional references made. Here's the output:
Output running from with LINQPad 8:




List<SimpleTest> (6 items) HelloGoodbye FiveSix
OneTwo
BuckleMy shoe
ThreeFour
ShutThe Door
PickupSticks



Output running from a console app with LINQPad.Runtime (7.8.7) via Nuget as well
and LINQPad.Runtime (8.0.1.0) copied from C:\Program Files\LINQPad8)



List<SimpleTest> (6 items) HelloGoodbye
OneTwo
BuckleMy shoe
ThreeFour
ShutThe Door
FiveSix
PickupSticks



Yes, both output display exactly the same way in a browser (I used Edge and Chrome), but because the generated Html is different it causes incompatibility. I use LINQPad to prototype Web pages (Dump is so awesome!), but now I can't move them to C# in my VS 2022 project. Would it be possible to have the runtime XhtmlWriter generate the same code (I think thead and tbody should be there)?

Comments

Sign In or Register to comment.