BUG: You may receive a "Visual Basic internal compiler error" error message when you use the ADDHANDLER statement or the REMOVEHANDLER statement in Visual Studio .NET (819349)



The information in this article applies to:

  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual Basic .NET (2003)

SYMPTOMS

You can pass an array as a base reference to the event in the ADDHANDLER statement or in the REMOVEHANDLER statement in your application. However, when you try to compile your application, the compiler stops responding instead of displaying compilation errors. When you close the Microsoft Visual Studio .NET IDE, you may receive the following error message:

Visual Basic .NET compiler is unable to recover from the following error: System Error &Hc0000005&(Visual Basic internal compiler error)
Save your work and restart Visual Studio .NET.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION


Steps to Reproduce the Problem

  1. In Visual Studio .NET, start a new console application by using Visual Basic .NET.

    By default, Module1 is created.
  2. Add the following code to the Main procedure in Module1:
  3.  Dim a() As Integer
    'Add a handler to the event of the array.
    AddHandler a.e, AddressOf Main
    RemoveHandler a.e, AddressOf Main
  4. On the Build menu, click Build Solution.
  5. In the Output window, you can see the following message:

    Performing main compilation

    However, the compilation is not completed. The compiler stops responding and does not show the errors in the code.
  6. On the Build menu, click Cancel to end the compilation.
  7. Close the IDE. You may receive the error message in the "Symptoms" section.

REFERENCES

For more information about events and event handlers, visit the following Microsoft Web site:

http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconUnderstandingEventHandlers.asp

Modification Type:MinorLast Reviewed:1/26/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbpending kbProperties kbEvent kbCompiler kbbug KB819349 kbAudDeveloper