Is it possible to use Util.Demand when dumping to another panel?
I'm trying to use Util.Demand when dumping an object to a new Panel using the extension method from https://forum.linqpad.net/discussion/1088/dumping-in-different-panel ?
I am currently having two issues.
1. When you click on the Link you get a javascript error Unable to get property 'webview' or undefined or null reference.
2. if you dump an object which implements LINQPad.ICustomMemberProvider , then the link is not even displayed.
The following is a very simple example script
void Main() { var dates = (from r in Enumerable.Range(1, 5) select new DateTime(2003, 8, r)).ToArray(); (from r in dates select new DailyValue1 { Date = r, Link = Util.OnDemand("Evaluate", () => r) }).DumpX("Panel"); (from r in dates select new DailyValue2 { Date = r, Link = Util.OnDemand("Evaluate", () => r) }).DumpX("Panel"); } public class DailyValue1 { public DateTime Date { get; set; } public object? Link { get; set; } } public class DailyValue2 : LINQPad.ICustomMemberProvider { public DateTime Date { get; set; } public DumpContainer? Link{ get; set; } IEnumerable<string> ICustomMemberProvider.GetNames() { return new[] { "Date", "Link" }; } IEnumerable<Type> ICustomMemberProvider.GetTypes() { return new[] { typeof(DateTime), typeof(DumpContainer) }; } IEnumerable<object?> ICustomMemberProvider.GetValues() { return new object?[] { this.Date, this?.Link, }; } } public static class Extensions { public static T DumpX<T>(this T toDump, string panelName) { System.Windows.Forms.WebBrowser browser; TextWriter formatter; var panel = PanelManager.GetOutputPanel(panelName); bool first = panel == null; if (first) { panel = PanelManager.DisplayControl(browser = new System.Windows.Forms.WebBrowser(), panelName); formatter = Util.CreateXhtmlWriter(true); browser.Tag = formatter; bool init = true; browser.DocumentCompleted += (sender, args) => { if (init) browser.DocumentText = formatter.ToString(); init = false; }; } else { browser = (System.Windows.Forms.WebBrowser)(panel.GetControl()); formatter = (TextWriter)browser.Tag; } formatter.WriteLine(toDump); if (first || browser.ReadyState == System.Windows.Forms.WebBrowserReadyState.Complete) browser.DocumentText = formatter.ToString(); return toDump; } }
Is there any way around this?