DOCUMENT:Q186273 30-MAY-1998 [vbwin] TITLE :BUG: AV Running VB5-Built Component in Multi-Threaded Environmen PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0,97,97sp1,97sp2,97sp3 OPER/SYS:WINDOWS KEYWORDS:kbVBp500bug ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 5.0 - Microsoft Visual Studio versions 97, 97sp1, 97sp2, 97sp3 --------------------------------------------------------------------- SYMPTOMS ======== When running an apartment model DLL created in Visual Basic 5.0 in a Multi-threaded 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. 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 Solution Type : kbpending ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.