[Mono-bugs] [Bug 76849][Wis] New - Can't compile assembly that uses [Obsolete(IsError=true)]-marked types

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Nov 29 12:52:51 EST 2005

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 jonpryor at vt.edu.


--- shadow/76849	2005-11-29 12:52:51.000000000 -0500
+++ shadow/76849.tmp.3136	2005-11-29 12:52:51.000000000 -0500
@@ -0,0 +1,72 @@
+Bug#: 76849
+Product: Mono: Compilers
+Version: 1.1
+OS: other
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: jonpryor at vt.edu               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Can't compile assembly that uses [Obsolete(IsError=true)]-marked types
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+Mcs' ObsoleteAttribute handling is overzealous -- if you specify that use
+of a type/member is an error (by passing `true' as the 2nd parameter),
+*all* uses of that type/member generate errors -- even when compiling the
+assembly with the obsoleted members!
+For example, I plan on removing many members & types from Mono.Unix.  For
+the next release, I would like to mark them so that use of these members
+produces an error, as they won't exist in the next+1 release.  To do this I
+need to be able to specify that the types/members are erroneous, but
+continue to use them in other obsoleted parts of the code.  Mcs doesn't
+permit this.
+Steps to reproduce the problem:
+1. Compile the following code:
+	using System;
+	[Obsolete ("Some Message", true)]
+	class Error {
+	}
+	[Obsolete ("Another Message", true)]
+	class Foo {
+		public static Error Error {set {}}
+	}
+	class Test {
+		public static void Main ()
+		{
+		}
+	}
+Actual Results:
+	oe.cs(9) error CS0619: 'Error' is obsolete: 'Some Message'
+	Compilation failed: 1 error(s), 0 warnings
+Expected Results:
+No compiler error.  Use of Obsolete(IsError=true) members from within the
+same assembly shouldn't be an error.
+How often does this happen? 
+Additional Information:
+Microsoft CSC.EXE v1.1 compiles the above code without error.

More information about the mono-bugs mailing list