FIX: Custom applications that use the Visual Studio for Applications Visual Basic Runtime may be unable to compile macros or to run macros


Consider the following scenario:
  • You create a custom application by using the Microsoft .NET Framework 2.0.
  • The custom application uses the Microsoft Visual Studio for Applications (VSA) Visual Basic Runtime.
  • You run the custom application on a system that has been updated to run a later version of the Microsoft .NET Framework common language runtime (CLR).
In this scenario, the custom application may behave incorrectly or may generate errors. These problems occur when you try to compile macros or when you try to run macros in the custom application.

When you are developing the custom application by using VSA, you may experience the following problem. When the custom application calls the Microsoft.VisualBasic.Vsa.VsaEngine.Compile method, an exception is thrown by the VSA Visual Basic Runtime to the host. The host may trap the exception, and the user may receive the following error message:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Alternatively, the host may ignore the exception, and one of the following symptoms may occur:
  • The host fails unexpectedly when the user tries to run the macro that the user just compiled.
  • The host does not handle the macro in any way.
In the latter case, the CLR will close the application because the application had an unhandled exception.

When you try to run macros in the custom application, you may experience one or more of the following symptoms:
  • You receive an error message that a macro cannot be generated or run.
  • You receive an error message that a macro or assembly cannot be loaded.
  • The host application may not start or may exit unexpectedly.
  • Although the host application does not report an error, the macro does not run, and the application appears to have done nothing.


This problem occurs because of a recent design change in the CLR workstation runtime (Mscorwks.dll) for builds of the .NET Framework 2.0 that are later than 2.0.50727.300. This change introduced a compatibility problem for the Visual Basic Runtime engine (Vsavb7rt.dll) that is used by VSA. The problem prevents assemblies from beng generated correctly during the macro compile operation.

This problem may cause the exception error message that is mentioned in the "Symptoms" section to be returned to the host application. The host application may report this error to the user in some manner. Alternatively, the host application may throw an exception and exit unexpectedly.

Note Custom applications that use the full-feature Microsoft Visual Studio for Applications Software Development Kit (SDK) and the .NET Framework 1.1 do not experience this problem. This problem occurs only in host applications that use the VSA runtime that is included with the .NET Framework 2.0.


Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To download this hotfix from the MSDN Code Gallery, visit the following Microsoft Web site:

Note The MSDN Code Gallery displays the languages for which the hotfix is available. If you do not see your language listed, it is because the Code Gallery resource page is not available for that language.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:


No prerequisites are required.

Restart requirement

You do not have to restart the computer after you apply this hotfix.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
Operating systems earlier than Windows Vista
File nameFile versionFile sizeDateTimePlatform
Windows Vista
File nameFile versionFile sizeDateTimePlatform


Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

More Information

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates


ID do Artigo: 928208 - Última Revisão: 23/03/2009 - Revisão: 1