BUG: Server Not Released if Raise Error in Class_Initialize (193438)



The information in this article applies to:

  • Microsoft Visual Basic Learning Edition for Windows 5.0
  • Microsoft Visual Basic Learning Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 5.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 5.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

This article was previously published under Q193438

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.

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbActivexEvents kbBug kbpending kbServer KB193438