Error 0x80070002 in the CoCreateInstance function when you use registration-free COM activation to load a COM object in a .NET Framework 2.0 SP2-based or .NET Framework 3.5 SP1- based application

Applies to: .NET Framework 3.5 Service Pack 1

Symptoms


Consider the following scenario:
  • You use registration-free COM activation to load a COM component. The component is implemented in managed code in a Microsoft .NET Framework 2.0 Service Pack 2 (SP2)-based application or in a Microsoft .NET Framework 3.5 Service Pack 1 (SP1)-based application.
  • You activate the appropriate activation context in the application.
  • You use the CoCreateInstance function to create a COM object instance on the application.
  • The name of the COM object or the full name of the assembly that contains the COM object is very long.
In this scenario, the CoCreateInstance function returns error code 0x80070002.

Cause


This problem occurs because the long name of the COM object or the long name of the assembly causes an “ERROR_INSUFFICIENT_BUFFER” error in the SxsLookupClrGuid function of the Sxs.dll assembly. Therefore, the .NET Framework execution engine increases the buffer size and calls the function again. However, an incorrect flag is passed to the SxsLookupClrGuid function.

Note
The SxsLookupClrGuid function is invoked by the CoCreateInstance function.

Resolution


Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply this hotfix, you must have the .NET Framework 2.0 SP2 or the .NET Framework 3.5 SP1 installed on one of the following operating systems:
  • Windows XP
  • Windows Server 2003
  • Windows Vista SP2
  • Windows Server 2008 SP2
Note If you receive one of the following error messages during the hotfix installation process, check to determine whether you are running an appropriate operating system and service pack. These are listed earlier in this section.

This update does not apply to this system
This update is not applicable to your computer

Restart requirement

You have to restart the computer after you apply this hotfix if the affected files are being used.

Hotfix replacement information

This hotfix does not replace any other hotfix.

File Information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.


For all supported x86-based versions of Windows XP and of Windows Server 2003
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.5060989,52826-Oct-201006:05x86
Mscorlib.dll2.0.50727.50604,550,65626-Oct-201006:05x86
Mscorwks.dll2.0.50727.50605,824,84826-Oct-201006:05x86
Sos.dll2.0.50727.5060388,93626-Oct-201006:05x86
For all supported x64-based versions of Windows XP and of Windows Server 2003
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.50601,755,48026-Oct-201001:01x64
Mscorlib.dll2.0.50727.50604,567,04026-Oct-201000:56x64
Mscorwks.dll2.0.50727.506010,044,75226-Oct-201001:00x64
Sos.dll2.0.50727.5060485,19226-Oct-201000:57x64
For all supported IA-64-based versions of Windows XP and of Windows Server 2003
File nameFile versionFile sizeDateTimePlatform
Mscordacwks.dll2.0.50727.50613,082,58427-Oct-201005:01IA-64
Mscorlib.dll2.0.50727.50614,009,98427-Oct-201005:00IA-64
Mscorwks.dll2.0.50727.506120,194,12827-Oct-201004:56IA-64
Sos.dll2.0.50727.5061872,77627-Oct-201004:59IA-64
For all supported x86-based versions of Windows Vista SP2 and of Windows Server 2008 SP2
File nameFile versionFile sizeDateTimePlatform
Mscorlib.dll2.0.50727.50614,550,65602-Nov- 201010:56x86
Mscordacwks.dll2.0.50727.5061989,52802-Nov-201010:56x86
Mscorwks.dll2.0.50727.50615,824,84802-Nov- 201010:56x86
Sos.dll2.0.50727.5061388,93602-Nov-201010:56x86
For all supported x64-based versions of Windows Vista SP2 and of Windows Server 2008 SP2
File nameFile versionFile sizeDateTimePlatform
Mscorlib.dll2.0.50727.50614,567,04002-Nov- 201010:55x64
Mscordacwks.dll2.0.50727.50611,755,48002-Nov-201010:55x64
Mscorwks.dll2.0.50727.506110,044,75202- Nov-201010:55x64
Sos.dll2.0.50727.5061485,19202-Nov-201010:55x64
For all supported IA-64-based versions of Windows Server 2008 SP2
File nameFile versionFile sizeDateTimePlatform
Mscorlib.dll2.0.50727.50614,009,98402-Nov-201011:14IA- 64
Mscordacwks.dll2.0.50727.50613,082,58402-Nov-201011:14IA-64
Mscorwks.dll2.0.50727.506120,194,12802-Nov- 201011:14IA-64
Sos.dll2.0.50727.5061872,77602-Nov-201011:15IA-64

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.