FIX: You receive an access violation when you open a Visual C# project in Visual Studio 2010 and an enum and a class have the same fully qualified name

Symptoms

Consider the following scenario:

  • You have a Visual C# project in Microsoft Visual Studio 2010.

  • You define an enumeration (enum) and a class that have the same name in the same project namespace so that these two types have the same fully qualified name.

  • The class contains a static constructor.

  • You open the project by using the IDE.


In this scenario, an Access Violation occurs and the IDE crashes. Additionally, an error message that resembles the following is logged in the Application log:

Problem Event Name:
Application Name: devenv.exe
Fault Module Name: cslangsvc.dll
Exception code: c0000005

Cause

This problem occurs because the IDE forces the compiler to bind a static constructor.

Resolution

To resolve this problem, apply this hotfix.

After you apply the hotfix, the Visual Studio IDE does not crash. Instead, you receive the following error message:

The namespace “namespace_name” already contains a definition for “class_name”.


More information about this hotfix

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:

http://support.microsoft.com/contactus/?ws=supportNote In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

You must have Microsoft Visual Studio 2010 installed to apply this hotfix.

Restart information

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.

File name

File version

File size

Date

Time

Platform

Cslangsvc.dll

10.0.30319.346

5,769,552

06-Aug-2010

05:42

x86

Status

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

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×