Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘compiler’

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

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.
Resolution
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

How to enable the “Option Strict” and “Option Explicit” statements in Visual Basic applications

Symptoms
This article describes how to enable the Option Strict and Option Explicit statements in Microsoft Visual Basic applications for code-behind files and files that are contained in the App_Code folder.
Resolution
To enable the Option Strict and Option Explicit statements in the code-behind files and files that are contained in the App_Code folder of a Visual Basic application, override the compiler configuration in the system.codedom section of the Web.config file for the application. To do this, add the following code to the Web.config file:

<system.codedom> <compilers> <compiler language=”c#;cs;csharp” extension=”.cs” type=”Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ warningLevel=”0″/> <compiler language=”vb;vbs;visualbasic;vbscript” extension=”.vb” type=”Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ warningLevel=”0″ /> </compilers> </system.codedom>