DumpContainer finished updating content - can I trap when it is finished rendering?
I am using LINQPad 5 as a light(er) - weight simulator of another app. My script will call some ORM-like libraries that load some dense object structures. Not surprisingly, it can take a while for LINQPad to render these objects. I am looking for a way to detect when rendering is complete so I keep track of time to render. I am using DumpContainers to dump the object and have tried the ContentUpdated event. I am finding that recording the time there gets me the time when the new object was set to the DC's Content property which makes sense. My guess is the rendering internals are inside the underlying controls some way? I think I have read in other posts this is really WPF under the covers?
Comments
Results in LINQPad are formatted as HTML and are rendered with a web browser; in the case of dump containers, via a DOM update. Are you trying to measure the time to perform the database query or for the web browser to render the HTML? If the former, you just need to ensure that you fully materialize the query before sending it to the DumpContainer (e.g., by calling ToArray() on the query). If the latter, you would need to use Util.InvokeScript to execute JavaScript that subscribes to an HTML event of some kind that fires when updates to the DOM have been rendered (this might be tricky). I'm not sure what you would achieve by measuring browser performance.
If you're worried about overloading the browser by excessive updates, this shouldn't happen because LINQPad thins DumpContainer updates as necessary to ensure that no backlog occurs and the UI thread remains responsive.
Awesome! The db query timings I already have... it is the time to consume the data from the db that I am trying to measure. Your suggestion of using ToArray() is probably the easiest way to go. Thanks Joe.