Microsoft KB Archive/314306

From BetaArchive Wiki

PSS ID Number: 314306

Article Last Modified on 5/23/2002



The information in this article applies to:

  • Microsoft COM+ 1.0



This article was previously published under Q314306

SYMPTOMS

When you register a Microsoft Visual Basic GlobalMultiUse class on the Microsoft Windows 2000 platform as an in-process component, and the Visual Basic GlobalMultiUse class is called from a COM+ server application, a 0x8001010e error may appear at certain times after a method call.

"The application called an interface that was marshaled for a different thread."

CAUSE

By default, the COM+ component COMTIIntrinsics property is set to TRUE before COM+ Rollup Hotfix 10. This forces the in-process component in the Visual Basic GlobalMultiUse class to create in a non-default context. This is one of the circumstances that causes the GlobalMultiUse class to fail.

RESOLUTION

By default, COM+ Rollup Hotfix 10 has the COMTIIntrinsics property set to FALSE. Newly-installed components are not affected by this problem. For existing components, newly applied COM+ Rollup Hotfix 10 does not change the COMTIIntrinsics property of the existing components. You can resolve this problem if you delete the existing components and then you reinstall the components in the COM+ snap-in.

For large scale deployment, the problem is fixed programmatically by setting the COMTIIntrinsics property of the specific COM+ component to FALSE by using COMAdminCatalog objects.

Set Catalog = CreateObject("COMAdmin.COMAdminCatalog")
    
Set Applications = Catalog.GetCollection("Applications")
Applications.Populate
    
For i = Applications.Count - 1 To 0 Step -1
        
    Set Coms = Applications.GetCollection("Components", Applications.Item(i).Key)
    Coms.Populate
    For j = Coms.Count - 1 To 0 Step -1
        Set obj = Coms.Item(j)
        If obj.name = "Component_Prog_ID" Then
            obj.Value("COMTIIntrinsics") = FALSE
            Coms.SaveChanges
            goto end_line
        End If
    Next j
Next i
                

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start a new Visual Basic ActiveX DLL project.
  2. Add several GlobalMultiUse classes. One of the classes must have the StrAfter(string, string) method implemented:

    Public Function StrAfter(ByVal strContainer As String, ByVal strPtr As String) as String
        ' Find strPtr in strContainer and return the substring after the strPtr
    End Function
                        
  3. Register the dynamic-link library (DLL) module as an in-process component.
  4. Write a simple COM+ component that is named Tester.test. Add the ParseString method that calls a method of the in-process GlobalMultiUse class as shown in the following code sample:

    Public Function ParseString(ByVal vStr As String) as string
        ParseString = StrAfter(vStr, ",")
    End Function
                        
  5. Create a Visual Basic or a Microsoft Visual Basic Scripting Edition (VBScript) client that calls the COM+ component and the COM+ method.

    On a single-processor computer, the first eight calls always succeed, and the ninth call causes the 0x8001010e error to appear.


REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

292818 FIX: COMTIIntrinsics Property Is Not False by Default



294510 INFO: Post Windows 2000 Service Pack 2 COM+ Rollup Hotfix 10 Is Available


Keywords: kbprb KB314306
Technology: kbAudDeveloper kbCOMPlus100 kbCOMPlusSearch kbComSearch