[Mono-list] Difference in Obsolete attribute behaviour

Jakub Linhart jakub.linhart@vslib.cz
Tue, 01 Feb 2005 23:36:56 +0100


I have code like this:
 1 class TestClass1 {
 2     [Obsolete ("This method ObsoleteMethod1 is obsolete.", false)]
 3     public static void ObsoleteMethod1() {
 4         Console.WriteLine ("Executing ObsoleteMethod1()");
 5     }
 6 }

 7 class TestClass2 {
 8    [Obsolete ("This method ObsoleteMethod2 is obsolete.", true)]
 9    public static void ObsoleteMethod2() {
10        TestClass1.ObsoleteMethod1();
11    }
12    public static void NewMethod2() {
13        TestClass1.ObsoleteMethod1();
14        ObsoleteMethod2();
15    }
16}

If this code fragment is compiled under .NET framework, CSC reports  one 
error (CS0619) on line 13 and  one warning (CS0618) at line 14. You get 
2 errors (line 10, line 13) and 1 warning (line 14) under MONO 1.05 
(mcs). It looks like that CSC ignores every call to method marked as 
obsolete from other obsolete method. MCS reports every call to obsolete 
method as error or warning. Is it particular reason for such a behaviour?