ReadableExpressions icon indicating copy to clipboard operation
ReadableExpressions copied to clipboard

Exception when showing window

Open cbeamond opened this issue 3 years ago • 7 comments

I get this exception when viewing a certain automapper expression. I can't give give source due to NDA, but I can give you some limited other information.

Visual Studio 2109 v16.11.2 Automapper 10.1.1 .NET Core 3.1 ReadableExpresssions.Visualizer 4.1.0

I followed the instructions on https://agileobjects.co.uk/view-automapper-execution-plan-readableexpressions

It happens both with my code and the code as shown on the example. Installed from the market place https://marketplace.visualstudio.com/items?itemName=vs-publisher-1232914.ReadableExpressionsVisualizers

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at System.Windows.Forms.UnsafeNativeMethods.IWebBrowser2.get_RegisterAsDropTarget()
   at System.Windows.Forms.WebBrowser.set_AllowWebBrowserDrop(Boolean value)
   at AgileObjects.ReadableExpressions.Visualizers.Dialog.Controls.VisualizerViewer.HandleShown(String translation)
   at AgileObjects.ReadableExpressions.Visualizers.Dialog.VisualizerDialog.<>c.<.ctor>b__8_0(Object sender, EventArgs args)
   at System.Windows.Forms.Form.OnShown(EventArgs e)
   at System.Windows.Forms.Form.CallShownEvent()
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()

image

cbeamond avatar Nov 04 '21 22:11 cbeamond

I forgot to add that half an hour earlier I did get the expression viewer to show up when going through automapper internals and it did show a limited amount of code.

cbeamond avatar Nov 04 '21 22:11 cbeamond

I uninstalled and installed the previous version from commit 6a61c372b7ab3ce1a1b10f60d77db51ef21b4c67 and that works fine on my code. So either there was a change in the last version that broke something or a reinstall fixed it. I don't have time right now to test the reinstall theory or to test with the code from the example, but I am happy that the tool is working for me.

I'd be willing to test a few versions if you need help trying to pinpoint the issue.

cbeamond avatar Nov 04 '21 22:11 cbeamond

Thanks for letting me know about this - I've seen this error before when the debugger gets into a particular state, and closing + reopening Visual Studio has always fixed it. Whenever I've seen this happen the ToReadableString() extension method always still works, which implies it's something to do with the visualizer framework code.

Glad you sorted it out in the end!

SteveWilkes avatar Nov 05 '21 09:11 SteveWilkes

No problem! I did try restarting several times without success, in fact that's the first thing I tried. Only using the earlier version helped. Still, it's working well now :)

cbeamond avatar Nov 07 '21 20:11 cbeamond

Thanks for letting me know! That's actually more concerning for me, of course :D I'll have an updated version soonish, so we'll see how that one behaves...

SteveWilkes avatar Nov 08 '21 08:11 SteveWilkes

I've added a try/catch around the browser-control property-setting statements in v4.1.1 of the visualizers (now on the VS Marketplace) - apparently this error can be thrown if you try to set them before the control is quite 'ready', but it shouldn't be considered fatal, and shouldn't render the control unusable. With a bit of luck that'll be the end of these exceptions!

SteveWilkes avatar Nov 14 '21 19:11 SteveWilkes

I'm also getting the same issue with version 4.1.1

Tvde1 avatar Nov 16 '21 09:11 Tvde1

I've released v4.6 of the visualizers to VS Marketplace, which has changes to hopefully improve the visualizer's stability.

SteveWilkes avatar Sep 10 '23 09:09 SteveWilkes