[BUG] Dump to html not working correctly, some parts missing or repeating
Hi
I have some problem when dumping nested DumpContainer
I first saw the the missing parts problems, I managed to see part of the problem by setting breakpoints in the browser and it seems like that when appending to a DumpContainer the generated JavaScript contains snippets with:
e7.innerHTML = "<div id='AppendedEllement' ,,,> ... <./div>";
where morelikely there should have been:
e2.insertAdjacentHTML('beforeend', "<div id='AppendedEllement' ,,,> ... <./div>");
Unfortunately I have not been able make simple code to reproduce the above but in attempt I got some repeating parts instead
In both cases the error seems highly timing dependent.
Here is the code that course repeating parts (I did not attempt to analyze the generate html code for below example):
var dc = new DumpContainer(); dc.Dump("Test: some numbers are repeated try decrease `timeout` if the two looks the same"); DumpContainer dc2 = null; var timeout = 50; var limit = 400-1; var j = 0; Timer timer = null; timer = new Timer(_=>{ if(j%40==0){ dc2=new(); var control = dc2.ToControl(); dc.AppendContent(control, true); } var dc3 = new DumpContainer($"{j:D3},").ToControl(); dc3.Styles["display"] = "inline-block"; dc2.AppendContent(dc3, true); if (j == limit) { dc.Dump("Dump it again: here we see that each numer is only once in the container"); timer.Change(Timeout.Infinite,Timeout.Infinite); } j ++; }, null, timeout, timeout);
Expected output something like this (what numbers that get repeated varies from run to run :
Comments
A possible workaround for your example is to add
dc2.Refresh();
after you have appended your content.Of course if the error is highly timing dependent, this may not fix when you use it for real.
You are right, that will not work in my real code
Thanks for the repro - there will be a fix in the next beta.