KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q193438: BUG: Server Not Released if Raise Error in Class_Initialize

Article: Q193438
Product(s): Microsoft Visual Basic for Windows
Version(s): 5.0,6.0
Operating System(s): 
Keyword(s): kbole kbActiveX kbActivexEvents kbServer kbVBp500bug kbVBp600bug kbOSWin95 kbGrpDSVB kb
Last Modified: 28-JAN-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual Basic Learning Edition for Windows, versions 5.0, 6.0 
- Microsoft Visual Basic Professional Edition for Windows, versions 5.0, 6.0 
- Microsoft Visual Basic Enterprise Edition for Windows, versions 5.0, 6.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

Raising an error in the Initialize event of a class module in an EXE server
keeps the server from being released.

STATUS
======

Microsoft has confirmed this to be a bug in the Microsoft products listed at the
beginning of this article.

MORE INFORMATION
================

Steps to Reproduce Behavior
---------------------------

1. Create a new ActiveX EXE project in Visual Basic. Class1 is created by
  default.

2. Add the following code to Class1:

        Private Sub Class_Initialize()
           Err.Raise vbObjectError + 1024
        End Sub

3. In the Project Properties, set the Project Name to MyServer.

4. Save the project as MyServer.vbp, and then make MyServer.exe.

5. Create a new Standard EXE project. Form1 is created by default.

6. Add the following code to Form1 in the new Standard EXE project:

        Private Sub Form_Load()
           Dim oServer As Object
           On Error GoTo Err_Init

           Set oServer = CreateObject("MyServer.Class1")
           Exit Sub

        Err_Init:
            Set oServer = Nothing
        End Sub

7. Run the standard EXE project, and then close it.

  In Windows 95 or Windows Me, press the CTRL+ALT+DEL key combination to open
  the Close Programs dialog box.

  -or-

  In Windows NT 4.0 or Windows 2000, press the CTRL+ALT+DEL key combination, and
  then click Task Manager.

  Note that MyServer.exe is still in memory.

Additional query words:

======================================================================
Keywords          : kbole kbActiveX kbActivexEvents kbServer kbVBp500bug kbVBp600bug kbOSWin95 kbGrpDSVB kbDSupport kbOSWinME 
Technology        : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB500Search kbVB600Search kbVBA500 kbVBA600 kbVB500 kbVB600
Version           : :5.0,6.0
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 1986-2002.