Threading issue calling form

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

Threading issue calling form
When calling an exterman program from Outlook Adding a cross-threading issue prevents form from initializing 
Alex Abramov




Posts: 34
Joined: 2006-09-15
Hello,

I have a button in Outlook Inspector which causes two seemingly related errors.
This only happens when Word is enabled as default email editor.
The first error is a Cross-thread Opeartion not valid (see below for details)
The second is DragDrop registration failed (see below for details)

After starting outlook and attemptint to engage the Inspector Button code, the first error comes up once, then the second one several times, eventually, the form does get created and is presented to user.


So far this happens on WinXP, OL2002, ADX2009 5.2.2024

Thanks in advance for any assistence.

Alex Abramov


Errors List:

First Error (cross-thread Operation not valid)

Detailed technical information follows:
---
(Inner Exception)
Date and Time: 4/7/2010 1:52:09 PM
Machine Name: ALEXAHP
IP Address: 192.168.1.112
Current User: AVID-TECH\alexa

Application Domain: DefaultDomain
Assembly Codebase: file:///K:/WINDOWS/assembly/GAC_MSIL/AddinExpress.MSO.2005/5.2.2024.2005__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=5.2.2024.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 5.2.2024.2005
Assembly Build Date: 7/17/2005 2:06:50 AM

Exception Source: AddToDMS
Exception Type: System.Exception
Exception Message: Cross-thread operation not valid: Control 'toolStripModules' accessed from a thread other than the thread it was created on.
Exception Target Site: btnAddContact_Click

---- Stack Trace ----
AddToDMS.AddinModule.btnAddContact_Click(sender As Object)
AddinModule.cs: line 0419, col 17, IL 0830 (0x33E)
AddinExpress.MSO.ADXCommandBarButton.x83f2606d869f908a(x128517d7ded59312 As x550331f9b13a67da, x17ee07e836b01668 As Boolean&)
AddinExpress.MSO.2005.dll: N 0030 (0x1E) IL



(Outer Exception)
Date and Time: 4/7/2010 1:52:09 PM
Machine Name: ALEXAHP
IP Address: 192.168.1.112
Current User: AVID-TECH\alexa

Application Domain: DefaultDomain
Assembly Codebase: file:///K:/WINDOWS/assembly/GAC_MSIL/AddinExpress.MSO.2005/5.2.2024.2005__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=5.2.2024.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 5.2.2024.2005
Assembly Build Date: 7/17/2005 2:06:50 AM

Exception Source:
Exception Type: AddinExpress.MSO.ADXExternalException
Exception Message: An error has occured in the code of the add-in.
Exception Target Site: Object reference not set to an instance of an object.

---- Stack Trace ----


Second Error (DragDrop Registration Failed)
Detailed technical information follows:
---
(Inner Exception)
Date and Time: 4/7/2010 2:00:23 PM
Machine Name: ALEXAHP
IP Address: 192.168.1.112
Current User: AVID-TECH\alexa

Application Domain: DefaultDomain
Assembly Codebase: file:///K:/WINDOWS/assembly/GAC_MSIL/AddinExpress.MSO.2005/5.2.2024.2005__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=5.2.2024.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 5.2.2024.2005
Assembly Build Date: 7/17/2005 2:06:50 AM

Exception Source: AddToDMS
Exception Type: System.Exception
Exception Message: DragDrop registration did not succeed.
Exception Target Site: btnAddContact_Click

---- Stack Trace ----
AddToDMS.AddinModule.btnAddContact_Click(sender As Object)
AddinModule.cs: line 0419, col 17, IL 0830 (0x33E)
AddinExpress.MSO.ADXCommandBarButton.x83f2606d869f908a(x128517d7ded59312 As x550331f9b13a67da, x17ee07e836b01668 As Boolean&)
AddinExpress.MSO.2005.dll: N 0030 (0x1E) IL



(Outer Exception)
Date and Time: 4/7/2010 2:00:23 PM
Machine Name: ALEXAHP
IP Address: 192.168.1.112
Current User: AVID-TECH\alexa

Application Domain: DefaultDomain
Assembly Codebase: file:///K:/WINDOWS/assembly/GAC_MSIL/AddinExpress.MSO.2005/5.2.2024.2005__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=5.2.2024.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 5.2.2024.2005
Assembly Build Date: 7/17/2005 2:06:50 AM

Exception Source:
Exception Type: AddinExpress.MSO.ADXExternalException
Exception Message: An error has occured in the code of the add-in.
Exception Target Site: Object reference not set to an instance of an object.

---- Stack Trace ----
Posted 07 Apr, 2010 13:07:23 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Alex,

Instead of invoking your code in the Click event of the button, send a custom message using the ADXAddinModule.SendMessage method, then, in the OnSendMessage event of the module, wait for this message and invoke your code. Find a sample code in the class reference or search through this forum.


Andrei Smolin
Add-in Express Team Leader
Posted 07 Apr, 2010 13:47:48 Top