Visual Studio does not throw a warning during build for events marked “Obsolete”

Article ID: 2832705 - View products that this article applies to.
Expand all | Collapse all

Summary

Symptoms

You have a C# Class library project with a class containing an event and you marked the event with the "Obsolete" attribute. When you add reference to this class library in other project, for example a Console application and subscribe to that event, no warning is generated in the latter project.

Typically a warning (CS0618) should be generated during compilation in Visual Studio when a method, event or property is marked with the "Obsolete" attribute.

ObsoleteAttribute is applicable to all program elements except assemblies, modules, parameters or return values and works as expected.

Cause

This is a known issue with Microsoft C# compiler.

More information

This issue is observed in all Editions of Visual Studio
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Properties

Article ID: 2832705 - Last Review: April 5, 2013 - Revision: 1.0
Applies to
  • Microsoft Visual Studio .NET 2003 Service Pack 1
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Service Pack 1
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2008 Professional Edition
  • Microsoft Visual Studio 2008 Service Pack 1
  • Microsoft Visual Studio 2010 Professional
  • Microsoft Visual Studio 2010 Service Pack 1
  • Microsoft Visual Studio Premium 2012
  • Microsoft Visual Studio Professional 2012
Keywords: 
KB2832705

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com