punker76 / MahApps.Metro.SimpleChildWindow

A simple child window for MahApps.Metro
MIT License
374 stars 55 forks source link

Exception using WebBrowser Control #72

Closed edgarcocco closed 5 years ago

edgarcocco commented 6 years ago

Hi, So im getting a FatalExecutionEngineError, when using WebBrowser Control, specifically after setting the Source Property of the control, the exception states the following:

Additional information: The runtime has encountered a fatal error. The address of the error was at 0x6b77b9eb, on thread 0x10c0. The error code is 0x80131623. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

fableforester commented 6 years ago

I am encountering the exact same problem right now. I am trying to open a ChildWindow containing a WebBrowser control, nothing special. It crashes when trying to open the window with the mentioned error as long as the WebBrowser control is there. If i take it out, it runs smoothly (but of course is empty). Unfortunately there is no useful output besides this:

The runtime has encountered a fatal error. The address of the error was at 0x7ba6a66f, on thread 0x3bd0. The error code is 0x80131623. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Did anybody find a solution or explanation for this?

edgarcocco commented 6 years ago

Sadly, i haven't found a solution to this yet.

AaronAnz commented 5 years ago

I'm not sure if anyone will see this but a workaround I found was to use WindowsFormsHost and use the WinForms WebBrowser instead.

https://www.wpf-tutorial.com/misc-controls/the-windowsformshost-control/

You may still have an error about MSHTML. Just add reference -> assemblies -> MSHTML. Also, you may have to right click the mshtml reference and set it to copy local like I did. Hope it helps.

Also, this seems to be an error with the WebBrowser not necessarily MahApps at all. I found people having a similar issue just trying to add a WPF WebBrowser to a seperate UserControl.