Microsoft KB Archive/314306

= PRB: Call to In-Process Component GlobalMultiUse Class from COM+ Application Causes 0x8001010e =

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.

&quot;The application called an interface that was marshaled for a different thread.&quot;



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(&quot;COMAdmin.COMAdminCatalog&quot;) Set Applications = Catalog.GetCollection(&quot;Applications&quot;) Applications.Populate For i = Applications.Count - 1 To 0 Step -1 Set Coms = Applications.GetCollection(&quot;Components&quot;, Applications.Item(i).Key) Coms.Populate For j = Coms.Count - 1 To 0 Step -1 Set obj = Coms.Item(j) If obj.name = &quot;Component_Prog_ID&quot; Then obj.Value(&quot;COMTIIntrinsics&quot;) = FALSE Coms.SaveChanges goto end_line End If   Next j Next i



Steps to Reproduce the Behavior
 Start a new Visual Basic ActiveX DLL project.  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  Register the dynamic-link library (DLL) module as an in-process component.  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, &quot;,&quot;) End Function  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.</ol>

<div class="references_section">