[Mono-bugs] [Bug 57835][Min] New - Incorrect and missing compiler warnings with attributes.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 29 Apr 2004 12:46:35 -0400 (EDT)
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 mark.smith135@btinternet.com.
http://bugzilla.ximian.com/show_bug.cgi?id=57835
--- shadow/57835 2004-04-29 12:46:35.000000000 -0400
+++ shadow/57835.tmp.25727 2004-04-29 12:46:35.000000000 -0400
@@ -0,0 +1,87 @@
+Bug#: 57835
+Product: Mono: Compilers
+Version: unspecified
+OS: other
+OS Details: Fedora Core 1
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: mark.smith135@btinternet.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Incorrect and missing compiler warnings with attributes.
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+a)Incorrect warning number produced with [Obsolete] attribute in code
+below.
+b)No warning produced with [ObsoleteAttribute] attribute in code below.
+
+Steps to reproduce the problem:
+1. mcs BasicAttributeDemo.cs
+
+
+Actual Results: From mcs on Fedora Core 1.
+BasicAttributeDemo.cs(29): warning CS0618:
+'BasicAttributeDemo.MyFirstDeprecatedMethod()' is obsolete
+BasicAttributeDemo.cs(31): warning CS0618:
+'BasicAttributeDemo.MyThirdDeprecatedMethod()' is obsolete: 'You
+shouldn't use this method anymore.'
+Compilation succeeded - 2 warning(s)
+
+Expected Results: From csc from .NET SDK v1.1 on Windows XP.
+BasicAttributeDemo.cs(29,3): warning CS0612:
+'BasicAttributeDemo.MyFirstDeprecatedMethod()' is obsolete
+BasicAttributeDemo.cs(30,3): warning CS0612:
+'BasicAttributeDemo.MySecondDeprecatedMethod()' is obsolete
+BasicAttributeDemo.cs(31,3): warning CS0618:
+'BasicAttributeDemo.MyThirdDeprecatedMethod()' is obsolete: 'You
+shouldn't use this method anymore.'
+
+How often does this happen?
+Always!
+
+Additional Information:
+Command 'mcs --version' gives "Mono C# compiler version 0.31.0.0".
+
+C# code to reproduce problem below.
+
+using System;
+
+class BasicAttributeDemo
+{
+ [Obsolete]
+ public void MyFirstDeprecatedMethod()
+ {
+ Console.WriteLine("Called MyFirstDeprecatedMethod().");
+ }
+
+ [ObsoleteAttribute]
+ public void MySecondDeprecatedMethod()
+ {
+ Console.WriteLine("Called MySecondDeprecatedMethod().");
+ }
+
+ [Obsolete("You shouldn't use this method anymore.")]
+ public void MyThirdDeprecatedMethod()
+ {
+ Console.WriteLine("Called MyThirdDeprecatedMethod().");
+ }
+
+ // make the program thread safe for COM
+ [STAThread]
+ static void Main(string[] args)
+ {
+ BasicAttributeDemo attrDemo = new BasicAttributeDemo();
+
+ attrDemo.MyFirstDeprecatedMethod();
+ attrDemo.MySecondDeprecatedMethod();
+ attrDemo.MyThirdDeprecatedMethod();
+ }
+}