BUG: AV Running VB5-Built Component in Multi-Threaded Environment

ID: Q186273


The information in this article applies to:


SYMPTOMS

When running an apartment model DLL created in Visual Basic 5.0 in a multithreaded environment such as Microsoft Internet Information Server (IIS) or Microsoft Transaction Server (MTS), the DLL fails periodically with an access violation (AV).


RESOLUTION

The following steps may be used to change the DLL to avoid the problem. This may not resolve the issue in all cases.

Step-by-Step Example

  1. Add a class module to the project.


  2. Set the name of the class to clsEmpty.


  3. Set the Instancing property of the class to 2-PublicNotCreatable.


  4. In Project Properties, set the Start Up Object to Sub Main.


  5. Add a BAS module, or put the following in an existing BAS module in the project:
    
          Public gEmpty As clsEmpty
          Public Sub main()
             Set gEmpty = New clsEmpty
          End Sub
     


  6. Save the project and re-compile.


NOTE: For Visual Basic 6.0 users there is an additional workaround. On the General Tab in the Project Properties dialog, set the project options for optimal performance: Unattended Execution and Retain In Memory.

For additional information please see the following article in the Microsoft Knowledge Base:
Q191119 : BUG: VB Classes Can Cause IIS to have Access Violations


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: MTS IIS crash gpf ipf kbVBp500bug kbDSupport kbdss


Keywords          : kbVBp500bug 
Version           : WINDOWS:5.0,97,97sp1,97sp2,97sp3
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 20, 1999