[Mono-bugs] [Bug 71058][Nor] New - mcs doesn't warn about [Obsolete] properties from other assemblies

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 6 Jan 2005 13:00:30 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by danw@novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=71058

--- shadow/71058	2005-01-06 13:00:30.000000000 -0500
+++ shadow/71058.tmp.18851	2005-01-06 13:00:30.000000000 -0500
@@ -0,0 +1,55 @@
+Bug#: 71058
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: danw@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: mcs doesn't warn about [Obsolete] properties from other assemblies
+
+If you refer to an obsolete property in your own assembly, mcs gives
+a warning. But if you refer to an obsolete property in another assembly
+(eg, gtk-sharp.dll), it doesn't.
+
+danw@twelve-monkeys:tmp> cat oblib.cs
+public class Foo {
+        [Obsolete]
+        public int Bar { get { return 0; } }
+ 
+        [Obsolete]
+        public void DoSomething () { ; }
+}
+danw@twelve-monkeys:tmp> mcs -target:library -o oblib.dll oblib.cs
+danw@twelve-monkeys:tmp> cat obtest.cs
+public class Bar {
+        public static int Main ()
+        {
+                Foo foo = new Foo ();
+                foo.DoSomething ();
+                return foo.Bar;
+        }
+}
+danw@twelve-monkeys:tmp> mcs -r:oblib.dll -o obtest.exe obtest.cs
+obtest.cs(7) warning CS0612: 'Foo.DoSomething()' is obsolete
+Compilation succeeded - 1 warning(s)
+danw@twelve-monkeys:tmp>
+
+
+Note that it warns about the obsolete method, but not about the
+obsolete property. But if you merge the two into one file, it warns
+about both:
+
+danw@twelve-monkeys:tmp> cat oblib.cs obtest.cs > obtest2.cs
+danw@twelve-monkeys:tmp> mcs -o obtest2.exe obtest2.cs
+obtest2.cs(14) warning CS0612: 'Foo.DoSomething()' is obsolete
+obtest2.cs(15) warning CS0612: 'Foo.Bar' is obsolete
+Compilation succeeded - 2 warning(s)
+danw@twelve-monkeys:tmp>