COM object that has been separated from its underlying RCW

Add-in Express™ Support Service
That's what is more important than anything else

COM object that has been separated from its underlying RCW
 
Pierre-D. Savard




Posts: 41
Joined: 2007-03-23
Hi, I have several error when I try to change or use the button state of toolbar button in outlook.

For example:

If myADXModule.toolTrack.State = AddinExpress.VSTO.ADXMsoButtonState.adxMsoButtonDown Then

I ot this error (not at each time): COM object that has been separated from its underlying RCW cannot be used.

Another error like this:
append on this code:

toolRegarding.Caption = "Regarding: " & sTexte
toolRegarding.TooltipText = Reponse(1)

RaceOnRCWCleanup was detected
Message: An attempt has been made to free an RCW that is in use. The RCW is in use on the active thread or another thread. Attempting to free an in-use RCW can cause corruption or data loss.

the 2 case are located in the OutlookItemEventsClass and ADXModule class.
How Can I do to resolve this? Thanks
Posted 30 May, 2007 10:33:27 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Pierre.

Most likely the button is not connected.
Is the button placed in Outlook inspector?


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 30 May, 2007 12:38:13 Top
Pierre-D. Savard




Posts: 41
Joined: 2007-03-23
Yes in the inspector. If I add breakpoint in my code the error are not called out anymore. But without breakpoint, I got the error sometime, I can't found a stable patturn
Posted 30 May, 2007 13:46:00 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Pierre.

The point is that you can change the state of inspector controls in the active inspector only. E.g. you can use the code above in the InspectorActivate event handler.
Posted 31 May, 2007 06:45:33 Top
Pierre-D. Savard




Posts: 41
Joined: 2007-03-23
ok, that mean i can't chnage the state a of button in another button function (click event) in the same inspector? Or in the process write of the outookItemEventsClass?

DO I have another way to acheive this?
Can I read the state without error or the same problem may appears?
Posted 31 May, 2007 15:22:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Pierre.

No. You can change/read the state where you want but the changes will apply if at least one inspector is opened. Please check the IsConnected property of the button before you call the State property.
Posted 01 Jun, 2007 07:33:00 Top
Pierre-D. Savard




Posts: 41
Joined: 2007-03-23
hi,
I try to put on a if bloc the code that generate the problem:

If toolRegarding.IsConnected = True Then
'toolRegarding.Caption = "Regarding: " & sTexte
'toolRegarding.TooltipText = Reponse(1)
End If

But if I do not put the 2 inner line in comment, i got the problem after several test. But in comment all work good. I have a active inspector displyed on the screen. I do:
1- Open the inspector
2- Click on the button ToolRegarding
3- This fonction call a dialog windows asking to select something
4- Close the dialog et return the selection
5- Put the selection name in the captin of the button

The wierd thing is that work well sometime and crash other time.
Posted 01 Jun, 2007 08:58:08 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Pierre, please send me the code. I will test it.
Posted 01 Jun, 2007 09:59:36 Top
Pierre-D. Savard




Posts: 41
Joined: 2007-03-23
OK I send it to your support email.
Posted 01 Jun, 2007 10:40:24 Top