Kinook Software Forums

Go Back   Kinook Software Forums > Visual Build Professional > [VBP] Suggestions

Thread Tools Rate Thread Display Modes
Old 01-25-2005, 09:10 AM
epearson epearson is online now
Registered User
Join Date: 01-25-2005
Location: Dallas, TX
Posts: 2
Threads that call custom actions

I noticed that when a custom action is invoked, it is on an MTA thread.

In my case, I was writing a C# custom action that used Installshield automation COM objects. Being on an MTA thread caused library loading problems which was very difficult to diagnose, and was solved when I executed my actual build logic on a new STA thread.

So, it would be nice in future versions of VBP if the thread that invokes custom actions could be an STA thread to provide a better environment for using COM interop.

For me, of course right now I can just do the new thread thing each time.
Reply With Quote
Old 01-27-2005, 11:27 AM
kinook kinook is online now
Join Date: 03-06-2001
Location: Colorado
Posts: 5,749
By default, COM registration for a .NET component is marked with ThreadingModel=Both, and since VBP's builder component runs in an MTA, so will the called component. If you change it to ThreadingModel=Apartment (registry entry is at HKEY_CLASSES_ROOT\CLSID\{your .NET component's guid}\InprocServer32\ThreadingModel; I'm not sure if .NET provides an attribute to change this behavior so it may need to be manually modified), COM should then create an STA for the component and run it there.
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

All times are GMT -5. The time now is 07:11 AM.

Copyright 1999-2019 Kinook Software, Inc.