Microsoft KB Archive/310939

= PRB: Errors When ATL Multi-Threaded ActiveX Script Host Runs Concurrent Scripts =

Article ID: 310939

Article Last Modified on 12/15/2003

-

APPLIES TO


 * Microsoft ActiveX Template Library 2.0
 * Microsoft ActiveX Template Library 3.0
 * Microsoft Visual C++ 6.0 Professional Edition

-



This article was previously published under Q310939



SYMPTOMS
When you attempt to use a multi-threaded ActiveX Scripting host that is written in Active Template Library (ATL) to run scripts on two or more threads simultaneously, and you call IActiveScriptParse::ParseScriptText, you may receive the following HRESULT from ParseScriptText:

Error: 0x80020101 (-2147352319)

SCRIPT_E_REPORTED

If the host implements IActiveScriptSite::OnScriptError, the EXCEPINFO structure that is returned from IActiveScriptError::GetExceptionInfo has the following scode:

Error: 0x80004005 (-2147467259)

E_FAIL: Unspecified error

The problem occurs very frequently on multi-processor computers, but it can also occur on a single-processor computer if the thread count is high.



CAUSE
The problem is related to the host's implementation of a named item object that is being used by the Microsoft Visual Basic Scripting Edition (VBScript) or Microsoft JScript script engine while the engine runs the scripts from multiple threads.

The ATL default implementation for IDispatch::GetIDsOfNames contains a small bug that can cause a named object to return an E_FAIL error message when it attempts to access the ITypeInfo interface for an object, even though the ITypeInfo interface is returned. This problem occurs independent of ActiveX Scripting but is frequently seen by ActiveX Scripting clients that are written in ATL.



RESOLUTION
For additional information on how to correct this problem in an ATL project, click the article number below to view the article in the Microsoft Knowledge Base:

266713 BUG: IDispatch::GetIDsOfNames May Return E_FAIL When Successful

