PRB: WMI Server Explorer Stops Responding While Debugging a Provider (331928)



The information in this article applies to:

  • Microsoft Windows Management Instrumentation in . NET

This article was previously published under Q331928

SYMPTOMS

When you debug a Windows Management Instrumentation (WMI) provider, and the debugger has stopped at a breakpoint, the WMI Server Explorer extension may not function as expected. Various problems may occur. For example, operations may block or the Visual Studio .NET IDE may stop responding.

CAUSE

This behavior occurs because the debugger freezes the whole provider host process. When the host process is frozen, this condition stops all other components that are hosted in that process from functioning. You may experience more such problems on a computer running Microsoft Windows 2000 and earlier operating systems. On these systems, the provider is loaded in the WMI service process (Winmgmt.exe).

In Windows XP and later versions, this problem does not affect all providers. The only providers that are affected are the providers that are sharing the host process with your provider (typically Wmiprvse.exe). Also, this problem affects any client applications that may call to these providers.

WORKAROUND

Regardless of the operating system that you use, it is a good idea to run the debugger in a different instance of Visual Studio .NET from the one where you run Server Explorer. This way, the problem that is described in this article will not affect the Visual Studio .NET IDE.

Additionally, on computers running Windows XP and later operating systems, it is highly recommended that you run your provider in a separate hosting process during development time. This way, when you debug your provider and the debugger stops at a breakpoint, only the process that is hosting your provider freezes. The rest of WMI continues to be accessible to Server Explorer and any other WMI-based applications or scripts. Also, if your provider quits unexpectedly (crashes) in this scenario, it will not affect the operation of other providers that are loaded in the same host process.

To make your provider load in its own host process, change the provider registration. Set the __Win32Provider.HostingModel property value to NetworkServiceHost:MyProvider where MyProvider is any string that uniquely identifies your provider. For example, you can use __Win32Provider.ClsId for this value. When your provider is ready for release, change the __Win32Provider.HostingModel property value to the value that you want in the final version of your application.

Modification Type:MinorLast Reviewed:7/30/2003
Keywords:kbDebug kbprb kbinfo KB331928 kbAudDeveloper