BUG: Visual Studio .NET IDE does not start if a COM+ package is created for MSXML 3.0 (322174)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2002), Professional Edition

This article was previously published under Q322174

SYMPTOMS

If you have created a COM+ package for Microsoft XML Parser 3.0 (MSXML 3.0), the Visual Studio .NET integrated development environment (IDE) does not start, and you receive the following error message:
The application cannot start.
When you click Help in the error message dialog box, you are prompted to reinstall Visual Studio .NET.

NOTE: This problem can occur in any application that is using MSXML 3.0 and that calls CoCreateInstance with CLSCTX_INPROC_SERVER. Note that you may receive a different error message with a different application.

CAUSE

Registering MSXML or any other COM component with COM+ intercepts all CoCreateInstance calls to that component. As a result, CoCreateInstance must be called with a CLSCTX_SERVER or a CLSCTX_ALL flag.

Visual Studio .NET calls CoCreateInstance on MSXML 3.0 during startup. Visual Studio .NET makes a call with CLSCTX_INPROC_SERVER, which is eventually unsuccessful because MSXML 3.0 has been registered with COM+ and expects CLSCTX_SERVER or CLSCTX_ALL.

RESOLUTION

To restart Visual Studio .NET:
  1. Delete the COM+ package that you created for MSXML3.0.
  2. Unregister Msxml3.dll. To do this, run the following from a command prompt:
    c:\>regsvr32 /u c:\winnt\system32\msxml3.dll
    					
  3. Reregister Msxml3.dll. To do this, run the following from a command prompt:
    c:\>regsvr32 c:\winnt\system32\msxml3.dll
    					
  4. Start Visual Studio .NET to confirm success.
If the error is faced in your application (**SP: ?), change your code to use CoCreateInstance with CLSCTX_SERVER or the CLSCTX_ALL switch.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

The syntax of the CoCreateInstance COM API call is as follows:
STDAPI CoCreateInstance(
REFCLSID rclsid, //Class identifier (CLSID) of the object
LPUNKNOWN pUnkOuter, //Pointer to controlling IUnknown
DWORD dwClsContext, //Context for running executable code
REFIID riid, //Reference to the identifier of the interface
LPVOID * ppv //Address of output variable that receives 
            // the interface pointer requested in riid
); 

				
The third parameter, dwClsContext, is the context in which the code that manages the newly created object runs. The values are taken from the CLSCTX enumeration.

Microsoft does not recommend creating a COM+ Application Package for MSXML because of threading issues. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

252686 INFO: Do Not Configure MSXML in a COM+ Application

297997 PRB: MSXML Performance Bottleneck in ShareMutex Under Stress

Steps to Reproduce the Behavior

  1. Click Start, click Control Panel, double-click Administrative Tools, and then double-click Component Services.
  2. Expand Component Services, expand Computers, expand My Computer, and then expand COM+ Applications.
  3. Right-click COM+ Applications, point to New, and then click Application. The COM+ Application Install Wizard starts.
  4. Click Next, click Create an empty application, and then type Myxml in the Enter a name for the new application text box. For Activation type, leave the default selection.
  5. Click Next, click Next, and then click Finish.
  6. Expand the Myxml application, and then double-click Components. Right-click Components, click New, and then click Component. Click Next, and then click to select Install New Component. Locate Msxml3.dll in the Winnt\System32 directory.
  7. Accept all defaults. A new COM+ component is created.
  8. Configure the Visual Studio .NET IDE to show the start page, and then try to start Visual Studio .NET. You receive the error message that is described in the "Symptoms" section.

REFERENCES

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

306905 PRB: Visual Studio .NET IDE Does Not Open on Startup


Modification Type:MinorLast Reviewed:9/15/2005
Keywords:kbvs2002sp1sweep kbbug kbnofix KB322174