A client application may intermittently receive an error message when a client application tries to create a COM+ component (911359)
The information in this article applies to:
- Microsoft COM+ 1.0
- Microsoft COM+ 1.5
- Microsoft Windows Server 2003, Enterprise Edition
- Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
- Microsoft Windows Server 2003, Enterprise x64 Edition
- Microsoft Windows Server 2003, Standard Edition
- Microsoft Windows Server 2003, Standard x64 Edition
- the operating system: Microsoft Windows 2000, Professional
- the operating system: Microsoft Windows 2000, Server
- Microsoft Windows XP Home Edition
- Microsoft Windows XP Professional
SYMPTOMSWhen a client application tries to create a Microsoft COM+ component, the client application may intermittently receive an error message. Microsoft C++ applications may receive the following error message: E_INVALIDARG: "The parameter is incorrect" (0x80070057/-2147024809) Microsoft Visual Basic 6.0 applications may receive the following error message: Run-time error '5': "Invalid procedure call or argument" (0x800a0005/-2146828283) Client applications that are built on the Microsoft .NET Framework may receive the following error message: System.ArgumentException: "The parameter is incorrect."
at System.Runtime.Type.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
(with _HResult = 0x80070057/-2147024809) The COM+ application will typically function without error for some time immediately after the COM+ application is opened. The problem occurs intermittently, but increases in frequency over time until the application eventually fails on every activation request. Note When the client application is running on a remote computer, the following error message is logged in the system event log on the client computer: Event Type: Error
Event Source: DCOM
Event Category: None
Event ID: 10006
Description:
DCOM got error "One or more arguments are invalid " from the computer SERVERNAME when attempting to activate the server:
GUIDCAUSEThis problem occurs because the "COM initialization count" for a thread is incremented and decremented when the CoInitialize function and the CoUninitialize function are called. When this count reaches zero after you call the CoUninitialize function, COM will be uninitialized on the thread. When a COM+ STA ThreadPool thread is uninitialized, the thread's apartment activator is destroyed. The next activation request that is routed to this thread will fail with the E_INVALIDARG error message. This problem occurs because the thread apartment activator is no longer available. Only activation requests that are routed to the particular uninitialized thread will fail. As more COM+ ThreadPool threads become uninitialized, a larger percentage of requests will fail. When all COM+ ThreadPool threads become uninitialized, all requests will fail. If the process is restarted, the problem will recover for some time. However, the cycle will be repeated.RESOLUTIONTo resolve this problem, remove the CoInitialize calls and the CoUninitialize calls from the affected COM DLL. A COM DLL that exposes COM components and is loaded through COM calls from a client should not call the CoInitialize function or the CoUninitialize function on any thread that is used to load or to start the DLL. These threads are owned by the client application, by the COM runtime, or by the COM+ runtime. Only the COM DLL should call these APIs on additional threads that were explicitly created by the COM DLL. However, it is a common bug for COM DLLs to call the CoInitialize function and the CoUninitialize function in response to attach events and detach events in the DllMain function.
Note It is correct for a standard Win32 DLL that is not loaded through COM to call these APIs if the standard Win32 DLL plans to use COM APIs. However, these functions should not be called from the DllMain function. For more information about the CoInitialize function, visit the following Microsoft Developer Network (MSDN) Web site:
For more information about the DllMain function, visit the following MSDN Web site: Note One Microsoft component that contains this bug is the Cdo.dll component. This component is not supported in multithreaded environments. Instead, we recommend that you use the Cdosys.dll component or the Cdonts.dll component.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
247288
CDO applications are not supported in MTS or COM+
Modification Type: | Major | Last Reviewed: | 1/20/2006 |
---|
Keywords: | kbfix kbprb KB911359 kbAudITPRO kbAudDeveloper |
---|
|