When the Interop wrapper for a COM object (RCW) is released it releases the
references to that object and you get that error when you try to then access
that object. That is caused by calling Marshal.ReleaseComObject() on the
object, or a similar call such as FinalReleaseComObject(), as explained by
Tobias.
One thing to be aware of is that if you have an Explorer object (or any
other) and you pass a copy of that Explorer to a procedure and in that
procedure you call one of the release methods the original object is
released, not just the copy passed to the procedure:
DoFoobarSub(_explorer);
if (_explorer.Caption == "Inbox") // fires RCW exception
{
}
private void DoFoobarSub(Outlook.Explorer exp)
{
// whatever
Marshal.ReleaseComObject(exp);
}
Any attempt to access _explorer after calling that DoFoobarSub() method will
fire an RCW exception.
In addition, although you say there are no other addins at all, you also
have to bear that in mind. If your managed code addin is not shimmed to
provide an exclusive AppDomain for it then things like this or any
exceptions or crashes in any managed code addin in the default AppDomain
will affect your addin. That's why shimming is so important for managed code
addins.
--
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
If that happens even when you just use Outlook, maybe it's another Add-
In causing the problem. Try disabling installed Add-Ins.
Tobias- Hide quoted text -
There is no other addIns.
My question is if for expample i execute the following line of code:
--> myExplorer is active explorer
Marshal.ReleaseCOMObject(myExplorer.CommandBars);
so now, i'll failed to work with Otulook's Menu ??- Hide quoted text -
- Show quoted text -