DisconnectedContext was detected: BHO/Explorer Bar

K

Kim Briggs

I am developing an BHO/Explorer Bar using Addin Express for Internet
Explorer (a framework to get MSHTML/COM Interop newbies like myself off the
ground). Target browser is IE7.

Occasionally, I get this message (not reliably reproducible but seems to
happen with >1 tabs open -- so >1 BHO instances -- and around tab open/close
events):

DisconnectedContext was detected

Message: Context 0x15dd58' is disconnected. Releasing the interfaces from
the current context

(context 0x15d798).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.


Addin Express developers have been very helpful with most things I'm not
able to resoolve this. They suggest that I am not calling Release() on some
interfaces and to review my code. But I have no idea ahat to look for.

As I am just starting out with this I have only skeletal code sufficient for
proof-of-concept purposes. The only mildly esoteric things that I am doing
include:

- casting an object as mshtml.IHTMLDocument2 (using as keyword)
- iterating over mshtml.IHTMLDocument2.all and casting appropriate elements
as mshtml.DispHTMLInputElement
- iterating over mshtml.IHTMLDocument2.forms and casting elements as
mshtml.DispHTMLFormElement
- assigning event handlers for some document events (button.onclick,
form.onsubmit)

I don't know where to start tracking these errors. Is there any way to
identify the involved contexts (eg 0x15dd58) in the debugger and trap these
events? If not, how can I get a handle on this to track down the problem?

There is an axe over my head. Thanks for helping out.

Kim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top