muellermarkus
muellermarkus

Reputation: 81

CEFSharp within AddIn - "Cannot pass a GCHandle across AppDomains"

I'm programming an AddIn for Solid Edge using the SolidEdge Community AddIn. With this AddIn, an EdgeBar containing a website should be displayed.

Because I don't want to use the standard Windows Forms WebBrowser control (it only uses the IE rendering engine), I try to use the Chromium Embedded Framework with its .NET bindings CEFSharp (https://github.com/cefsharp/CefSharp).

When creating a fresh Windows Forms Application, embedding the CEFSharp control works just fine. But when I embed it in my AddIn code, I receive this following error after starting Solid Edge with the AddIn activated and the program crashes:

An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll

Additional information: Cannot pass a GCHandle across AppDomains.

I found a similar CEFSharp issue dealing with the AppDomain-problem (https://github.com/cefsharp/CefSharp/issues/351), but I don't really see a solution for my problem.

(Notes: Target Framework is .NET Framework 4.5, Output type Class Library. I'm using Visual Studio 2013, programming language is C#).

Upvotes: 4

Views: 2068

Answers (2)

Sam007
Sam007

Reputation: 8757

Got it to work for Excel in case, someone wants to know https://github.com/cefsharp/CefSharp/issues/1191#issuecomment-215503558

Upvotes: 0

muellermarkus
muellermarkus

Reputation: 81

This pull request (https://github.com/cefsharp/CefSharp/pull/1556) fully solves my problem. Because it hasn't made its way to CefSharp's master yet, I built it myself and everything works :-)

Let's hope this will be in release branch soon so no one will have to cope with this problem anymore.

Upvotes: 4

Related Questions