You are here: Office-Outlook.com  / Outlook Forum

Runtime callable wrapper (RCW) scope - process or application doma

Home » Outlook addins and plugins development » Developer Outlook add-ins
Runtime callable wrapper (RCW) scope - process or application doma [message #426244] Tue, 07 October 2008 12:08 Go to next message
Sunny[3]
Messages: 32
Registered: October 2008
Member
According to the docs for RCW (framework ver. 2.0 and up): "The runtime
creates exactly one RCW for each COM object, regardless of the number of
references that exist on that object. The runtime maintains a single RCW per
process for each object."

It's different for ver. 1.1 - the sentence about "one per process" is missing.

As there may be multiple AppDomains per process, and actually this is what
happens when you have multiple Outlook addins, installed with Shim Wizard,
what is the expected behavior of Marshal.ReleaseComObject(object)?

As an example:
If in my AppDomain (my addin) I have reference to a Message object in
Outlook, and (as per all good practices I read about), I use a loop around
Marshal.ReleaseComObject(message), is it going to release really all
references in the process, thus breaking another addin, which may hold a
reference to the same message?

Is there a difference in the implementation of this functionality between
..Net 1.1 and 2.0, or it is only a documentation change?

Thanks

P.S. I'm cross-posting, as I do not know which is the best group for this
question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #430585] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #457326] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #458958] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #459415] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #460428] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #461429] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #461890] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Re: Runtime callable wrapper (RCW) scope - process or application doma [message #463464] Wed, 08 October 2008 06:49 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
I can't claim to be an RCW expert, but in my tests and experiences with
managed code, if you have 2 Outlook addins that are running in separate
AppDomains then calling Marshal.ReleaseComObject() on say the Inspectors
collection doesn't have any effect on the Inspectors collection object
instantiated in a different AppDomain. The Inspectors events will continue
to fire, and no RCW errors appear.

Of course things might be different if both addins were running in the same
AppDomain, but that's something you shouldn't be doing anyway.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sunny" <icesunny@nospam.nospam> wrote in message
news:4F217399-B14F-4E4F-94B7-1190CCDE6B89@microsoft.com...
> According to the docs for RCW (framework ver. 2.0 and up): "The runtime
> creates exactly one RCW for each COM object, regardless of the number of
> references that exist on that object. The runtime maintains a single RCW
> per
> process for each object."
>
> It's different for ver. 1.1 - the sentence about "one per process" is
> missing.
>
> As there may be multiple AppDomains per process, and actually this is what
> happens when you have multiple Outlook addins, installed with Shim Wizard,
> what is the expected behavior of Marshal.ReleaseComObject(object)?
>
> As an example:
> If in my AppDomain (my addin) I have reference to a Message object in
> Outlook, and (as per all good practices I read about), I use a loop around
> Marshal.ReleaseComObject(message), is it going to release really all
> references in the process, thus breaking another addin, which may hold a
> reference to the same message?
>
> Is there a difference in the implementation of this functionality between
> .Net 1.1 and 2.0, or it is only a documentation change?
>
> Thanks
>
> P.S. I'm cross-posting, as I do not know which is the best group for this
> question.
Previous Topic:.NET AddIn - Version 1.1 and 2
Next Topic:Moving a textframe by a specific amount
Goto Forum: