I would like to apply ObsoleteAttribute to a property, but it seems that compiler generates warnings/errors only for direct usage of attribute, any indirect usage is silently ignored.
I think the following example illustrates the problem very well:
using System;
class Program
{
static void Main(string[] args)
{
var o = new Old();
Console.WriteLine(o.Geezer); // compilation fails: 'ObsoleteAttributeTest.Program.Old.Geezer' is obsolete: 'Some error'
Console.WriteLine(o.Geezer.Attributes); // compiles OK
}
class Old
{
[ObsoleteAttribute("Some error", true)]
public System.Xml.XmlElement Geezer { get { return null; } }
}
}