Re: Raising Events to COM Clients from .NET Assembly

Daniel Petersson <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <E8FBCCA96548DD46A1AC748F17EEAD9C0E90F5C532@cefalo-mail01.cefalo.local>
I'assume that what Steve is hinting about is the common problem with COM apartments.
Since .NET doesn't have care about the apartment story it is very easy to forget about your
COM clients and attempt to raise events using the wrong thread.

Since an event is a callback they can cause the same problems as calling COM objects
from the wrong apartment; this means RPC_E_WRONG_THREAD and friends =)

best regards,
Daniel Petersson

________________________________________
From: Discussion of development on the .NET platform using any managed              language [[email protected]] On Behalf Of Brady Kelly [[email protected]]
Sent: Wednesday, December 19, 2007 3:57 PM
To: [email protected]
Subject: Re: [DOTNET-CLR] Raising Events to COM Clients from .NET Assembly

Steve,  I'm not quite on the same page as you.  The object raising the
event, to COM, will be the COM server.

> > Are there any caveats regarding this?
> >
> >
> Yes, threading can be a real nightmare to get right.  If you are
> raising
> events to the COM client from multiple threads, you'll probably have
> trouble.  Make sure you only raise events back to the COM client from
> the
> thread that created the object raising the event.  This is especially
> true
> if the client is written in VB6.
>
> --
> Steve Johnson

===================================
This list is hosted by DevelopMentor?  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.