Microsoft KB Archive/831489

= BUG: The Visual Basic .NET compiler may stop responding when you try to build a project in Visual Studio .NET =

Article ID: 831489

Article Last Modified on 4/23/2007

-

APPLIES TO


 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition

-





SYMPTOMS
When you try to build a Microsoft Visual Basic .NET project in Microsoft Visual Studio .NET, the Visual Basic .NET compiler may stop responding. 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.



CAUSE
This bug occurs if your Visual Basic .NET project contains a file that uses the DirectCast keyword to pass an argument to the constructor of an attribute. For example, this behavior occurs if your project contains a file that uses the following code: 



WORKAROUND
To work around this bug, follow these steps:  Exit Visual Studio .NET after you receive the error message that is mentioned in the &quot;Symptoms&quot; section of this article. Restart Visual Studio .NET.  Use the CType keyword in your code instead of the using the DirectCast keyword in your code.

For example, your project may contain a file that uses the following code:  Replace this code with the following code:  The new code uses the CType keyword instead of the DirectCast keyword. 



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

<div class="moreinformation_section">

Steps to Reproduce the Behavior
To reproduce the behavior that is mentioned in the &quot;Symptoms&quot; section of this article, follow these steps:  Start Visual Studio .NET.</li> Use Visual Basic .NET to create a Console Application project.

By default, the Module1.vb file is created.</li>  In Module1.vb, locate the following code: Module Module1 </li>  Add the following code before the code that you located in step 3: Imports System.ComponentModel </li>  In Module1.vb, locate the following code: End Sub </li>  Add the following code after the code that you located in step 5: <DefaultValueAttribute(DirectCast(Nothing, String))> _ Private ReadOnly Property Prop As Integer Get End Get End Property </li> Build your application.

Notice the following output in the build window:

Preparing resources...

Updating references...

Performing main compilation...

The Visual Basic .NET compiler stops responding.</li> On the Build menu, click Cancel to stop trying to build your application.</li> On the File menu, click Close.

You receive the error message that is mentioned in the &quot;Symptoms&quot; section of this article.</li></ol>

<div class="references_section">