-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making CefSharp compatible with non-default AppDomains #1556
Conversation
… for CEF interfaces
@arsher Another interesting |
This is awesome! When this is going to be merged? Please make it happen 👍 |
This is really great news. I'll try to build this on myself while it makes its way to the master :-) |
After building it myself, the AppDomain problem I had some months ago (see www.stackoverflow.com/questions/31512997/cefsharp-within-addin-cannot-pass-a-gchandle-across-appdomains) is solved. Thanks a lot, @arsher! :-) |
Hurray! :D |
Previously it wasn't possible to write unit tests with any of the mainstream frameworks as they would spawn a new @arsher Thoughts? @mountgellert @Sukram21 If you can, contribute what time you have if you require this feature. It's not a priority with me and my time being very limited at the moment I'm not going to commit much time to this. |
@arsher, what kind of help you need for this to make to master? |
I use VC# 2013 together with VS unit testing framework. I am unable to run a unit test for CEF dependent code until this change makes it to the next CEF release. My current CEF is 47.0.2 |
Take it for a spin, compile your own version, test it out. Write some
Code won't be merged until it's been adequately tested, there are no plans to include this in any future releases yet. |
I'm frustrated that this isn't getting into main branch quickly, but I completely understand why. I'm going to try building and using this branch myself, but I know that's not the same as unit testing. Unfortunately, my lack of expertise in both cefsharp and unit tests for C# are limiting my helpfulness. But I just wanted to add my interest and note that one other person will be banging on it to find any cracks. Very much appreciate you putting the time into this, arsher. |
If you need an immediate solution then |
I would really appreciate it if this bugfix could make it to the master branch. @arsher please let me know if I can help with writing unit tests etc. |
I am also using this in a custom build and find it to be solid. I'm not acquainted with the testing standards and other acceptance thresholds for this project. I'd be happy to take direction and help with whatever is needed to get this in, though. |
@seveves @varigence To get this merged it really is a lot more than just creating some unit tests There are unanswered questions
The practical aspects:
There are probably a lot of other steps that will be added along the way. Personally I have no requirement for those feature and extremely limited time (to the point where someone else would need to take charge of the code reviews as well), |
This something I have hit on and wondering whether this change made it into master? I no good in that concept detailed in this ticket, so would you please help me answer this? Do you advise this fix to be part of a production enviornment? |
@shanadas This page is a Pull Request so at the top of the page you can see if it has been merged (it has not). From the initial description this PR was only done for the personal interest of the author and is not ready for production environments and has not been fully tested. Given that the PR was submitted 8 months ago, I recommend anyone wanting to see this change make its way into master to fork the author's branch and start addressing the issues detailed above by @amaitland. This is such a big change that it needs a new motivated individual to take the lead and stay active on Github to address future issues as the change makes its way into releases. For now you will need to use another framework like |
This week I ran into the same problem with the GCHandel and multiple AppDomains. In my case I want to render an html file which contains a d3 chart in an ASP.NET WebApi. Because the default appdomain is owned by the IIS itself I couldn't do that. After I looked at the code from @arsher I saw that the unmanaged part of CefSharp talks only with the default appdomain, which is in my case the IIS. My workaround for this is easy, let me explain: I have a class called CefSharpRenderer which looks like this. What it does is simple. It initializes Cef when it isn't already, then it creates a new
To make my workaround transparent to the caller I have an additional class which also implements the
In it's final version the The I will attach a simple example in which a console application creates a new appdomain and tries to interact with CefSharp. Also a WebApplication is inside this example. It shows that also with the IIS this approach works like a charm. For use this approach in a WebApplication the ShadowCopying must be disabled in the web.config otherwise Cef doesn't find it's references, but this is only a little problem. I hope this is understandable. Feel free to ask me any questions. |
@flole Great you have something working. In future, please refrain from discussing your ideas in a
As per https://github.com/cefsharp/CefSharp/blob/master/CONTRIBUTING.md#help-us-help-you |
@amaitland Sorry, I will post my workaround again under the issue #351 and create a new repo for my sample code. |
@arsher, thanks for the great feature! Unfortunately I cannot compile this branch against VS'15. Did you experience this issue? |
Any update on this or when it will be merged? |
Express interest as well although I do not have sufficient knowledge for the underlying library build and linking. Trying to use CefSharp embedded in an UserControl to host in another application. Having Chrome > IE many times over. |
This There are two other actively developed https://bitbucket.org/xilium/xilium.cefglue/overview |
Hi,
|
I have downloaded this solution and it is working with console app domain, but your WebApplication is showing only loading screen only. When I have traced it with performDependencyCheck=true then it gives error of Server Error in '/' Application. Exception Details: System.Exception: Unable to locate required Cef/CefSharp dependencies: Also If I run with performDependencyCheck=false then I am getting Cef.IsInitialized as true. |
Hi @arsher, I know it has been long since you gave this workaround. |
I had an idea about how to solve the non-default AppDomain problems with a very few effective modifications in the current code, using code generation. I took a look at issues #1488 and #351 and as far as I can tell the main concern against such changes was the possible extent of them. I think I managed to minimalize this by using libclang to parse the CEF headers and generate AppDomain safe wrappers around the relevant CEF interfaces. What do you guys think? Is this something that can be merged at some point?
Please take this for a spin, I did some testing of my own, but honestly only for the features relevant to me so there still might something off. This shouldn't change anything at all when used like the same way as before, and when not in the default appdomain it should only add the perf penalty of the cross-appdomain calls.