DisconnectedContext was detected after calling CefSharp.CEF.Shutdown()

325 views
Skip to first unread message

Nicolas Rafalowski

unread,
Jul 1, 2012, 3:59:04 AM7/1/12
to cefs...@googlegroups.com
I had a problem in windows xp that the process kept alive after closing my app.
 
I found a solution somewhere, to add this code at the end of my Main:
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
GC.WaitForPendingFinalizers();
CefSharp.CEF.Shutdown();
 
Initially that resolve my problem.
 
Now i added some code that calls an external URL (for my API), this cause that my application hangs out when calling the
GC.WaitForPendingFinalizers();
 
When I removed this code the CefSharp.CEF.Shutdown(); generartes an error like this:
DisconnectedContext was detected
Message: Context 0x6586e8' is disconnected.  Releasing the interfaces from the current context (context 0x658350).
This may cause corruption or data loss. 
To avoid this problem, please ensure that all contexts/apartments stay alive until the application is completely done 
with the RuntimeCallableWrappers that represent COM components that live inside them.
 
Any ideas what am I doing wrong????

Alex B

unread,
Jul 2, 2012, 4:17:20 AM7/2/12
to cefs...@googlegroups.com
Hi,

I had the same kind of problem on my end, but as stated in this thread it only occured when trying to end the app while the page was still loading. I wouldn't try to mess up with the garbage collector.

anthony taranto

unread,
Jul 2, 2012, 2:58:32 PM7/2/12
to cefs...@googlegroups.com
Do you have the Flash plugin loaded when you are experiencing this problem?

Nicolas Rafalowski

unread,
Sep 4, 2012, 11:07:36 AM9/4/12
to cefs...@googlegroups.com
Yes I have some flush plugin loaded
 
I have a code like this on my startup
 
var path = System.IO.Path.Combine(Application.StartupPath, "NPSWF32.dll");
cef.AddPluginPath(path);

anthony taranto

unread,
Sep 4, 2012, 3:04:20 PM9/4/12
to cefs...@googlegroups.com
Looks like CEF has a problem exiting cleanly when the flash plugin is loaded on windows xp, you might want to special case your shutdown process on XP to do something more aggressive, like this for example:

            if (Environment.OSVersion.Version.Major < 6)
            {
                // XP
                Process.GetCurrentProcess().Kill();

Nicolas Rafalowski

unread,
Sep 5, 2012, 3:29:46 AM9/5/12
to cefs...@googlegroups.com
Thanks I will do it right now

Nicolas Rafalowski

unread,
Sep 5, 2012, 3:31:32 AM9/5/12
to cefs...@googlegroups.com
how do I marke this question as answered

anthony taranto

unread,
Sep 5, 2012, 2:43:55 PM9/5/12
to cefs...@googlegroups.com
You just did.
Reply all
Reply to author
Forward
0 new messages