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

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
Properties

Article ID: 2832705 - Last Review: Apr 5, 2013 - Revision: 1

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 Professional Edition, Microsoft Visual Studio 2008 Professional 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

Feedback