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:

http:⁠//support.microsoft.com/contactus/?ws=support 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.

Note

This update does not apply to this system

Note

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 name File version File size Date Time Platform
Mscordacwks.dll 2.0.50727.5060 989,528 26-Oct-2010 06:05 x86
Mscorlib.dll 2.0.50727.5060 4,550,656 26-Oct-2010 06:05 x86
Mscorwks.dll 2.0.50727.5060 5,824,848 26-Oct-2010 06:05 x86
Sos.dll 2.0.50727.5060 388,936 26-Oct-2010 06:05 x86

For all supported x64-based versions of Windows XP and of Windows Server 2003

File name File version File size Date Time Platform
Mscordacwks.dll 2.0.50727.5060 1,755,480 26-Oct-2010 01:01 x64
Mscorlib.dll 2.0.50727.5060 4,567,040 26-Oct-2010 00:56 x64
Mscorwks.dll 2.0.50727.5060 10,044,752 26-Oct-2010 01:00 x64
Sos.dll 2.0.50727.5060 485,192 26-Oct-2010 00:57 x64

For all supported IA-64-based versions of Windows XP and of Windows Server 2003

File name File version File size Date Time Platform
Mscordacwks.dll 2.0.50727.5061 3,082,584 27-Oct-2010 05:01 IA-64
Mscorlib.dll 2.0.50727.5061 4,009,984 27-Oct-2010 05:00 IA-64
Mscorwks.dll 2.0.50727.5061 20,194,128 27-Oct-2010 04:56 IA-64
Sos.dll 2.0.50727.5061 872,776 27-Oct-2010 04:59 IA-64

For all supported x86-based versions of Windows Vista SP2 and of Windows Server 2008 SP2

File name File version File size Date Time Platform
Mscorlib.dll 2.0.50727.5061 4,550,656 02-Nov- 2010 10:56 x86
Mscordacwks.dll 2.0.50727.5061 989,528 02-Nov-2010 10:56 x86
Mscorwks.dll 2.0.50727.5061 5,824,848 02-Nov- 2010 10:56 x86
Sos.dll 2.0.50727.5061 388,936 02-Nov-2010 10:56 x86

For all supported x64-based versions of Windows Vista SP2 and of Windows Server 2008 SP2

File name File version File size Date Time Platform
Mscorlib.dll 2.0.50727.5061 4,567,040 02-Nov- 2010 10:55 x64
Mscordacwks.dll 2.0.50727.5061 1,755,480 02-Nov-2010 10:55 x64
Mscorwks.dll 2.0.50727.5061 10,044,752 02- Nov-2010 10:55 x64
Sos.dll 2.0.50727.5061 485,192 02-Nov-2010 10:55 x64

For all supported IA-64-based versions of Windows Server 2008 SP2

File name File version File size Date Time Platform
Mscorlib.dll 2.0.50727.5061 4,009,984 02-Nov-2010 11:14 IA- 64
Mscordacwks.dll 2.0.50727.5061 3,082,584 02-Nov-2010 11:14 IA-64
Mscorwks.dll 2.0.50727.5061 20,194,128 02-Nov- 2010 11:14 IA-64
Sos.dll 2.0.50727.5061 872,776 02-Nov-2010 11:15 IA-64

              

Status

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