PRB: Apartment Threaded Visual Basic Component Displays As a Single Thread Apartment in COM+ (260133)



The information in this article applies to:

  • Microsoft COM+ 1.0

This article was previously published under Q260133

SYMPTOMS

When a Visual Basic ActiveX DLL that has its threading model set to Apartment Threaded (in its project properties in Visual Basic) is imported into a COM+ application, the threading model attribute for its classes displays as a Single Threaded Apartment in the Component Services Microsoft Management Console (MMC) administration tool.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a new Visual Basic ActiveX DLL.
  2. Click Properties to view the properties of the project in Visual Basic in the Project menu. Verify that in Threading Model, "Apartment Threaded" is selected.
  3. Compile the DLL, and then put it into a new COM+ application.
  4. Click Properties to view the properties of the component in the newly created COM+ application in the Component Services MMC snap-in.
  5. In the Concurrency tab, Single Thread Apartment is shown as the Threading Model.
  6. Change the "Threading Model" for the Visual Basic project to "Single Threaded" in the Project Properties General tab.
  7. Recompile the project.
  8. Replace the DLL in the COM+ application you created with the new DLL.
  9. Verify that the threading model has changed to Main Thread Apartment.
The confusion stems from different names for the same threading model. The components marked as Single Threaded in Visual Basic are created in the main "Single-threaded Apartment" (STA) (as are legacy components whose threading model is not specified). COM+ calls these components Main Thread Apartment components. The Single Thread Apartment threading model in the COM+ catalog is the same as the Apartment Threaded threading model in Visual Basic.

REFERENCES

View "threading, apartment model" in MSDN.

Modification Type:MajorLast Reviewed:7/31/2001
Keywords:kbDSupport kbprb kbSysAdmin KB260133