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

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Dec 1 10:52:02 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.

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

--- shadow/76849	2005-12-01 07:56:17.000000000 -0500
+++ shadow/76849.tmp.17816	2005-12-01 10:52:02.000000000 -0500
@@ -1,13 +1,13 @@
 Bug#: 76849
 Product: Mono: Compilers
 Version: 1.1
 OS: other
 OS Details: 
-Status: RESOLVED   
-Resolution: FIXED
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Wishlist
 Component: C#
 AssignedTo: marek.safar at seznam.cz                            
 ReportedBy: jonpryor at vt.edu               
 QAContact: mono-bugs at ximian.com
@@ -101,6 +101,91 @@
 		}
 	}
 
 
 ------- Additional Comments From marek.safar at seznam.cz  2005-12-01 07:56 -------
 Fixed in SVN.
+
+------- Additional Comments From jonpryor at vt.edu  2005-12-01 10:52 -------
+We're getting closer.  One remaining issue that I can see: use of
+constants within an Obsolete class in a DllImport statement should be
+permissible, e.g. 
+
+	class Stdlib {
+		internal const string LIBC = "msvcrt.dll";
+		[DllImport (LIBC)]
+		public static extern IntPtr fopen (string s, string m);
+	}
+
+Here's a more complete example which works on CSC and fails with mcs:
+
+	using System;
+	using System.Runtime.InteropServices;
+
+	[Obsolete ("Use Errno", true)]
+	public enum Error {
+		EROFS,
+		ERANGE
+	}
+
+	[Obsolete ("Use Native.FilePosition", true)]
+	public class FilePosition {}
+
+	public class StdioFileStream {
+		[Obsolete ("", true)]
+		public void SaveFilePosition (FilePosition fpos)
+		{
+		}
+	}
+
+	[Obsolete ("Use Native.Dirent", true)]
+	public sealed class Dirent {
+		public string d_name;
+	}
+
+	[Obsolete ("Use Native.Stdlib", true)]
+	public class Stdlib {
+		internal const string LIBC = "msvcrt.dll";
+		[DllImport (LIBC)]
+			public static extern IntPtr signal (int signum, IntPtr handler);
+	}
+
+	[Obsolete ("Use Native.Syscall", true)]
+	public class Syscall : Stdlib {
+		public static Dirent readdir (IntPtr dir)
+		{
+			return new Dirent ();
+		}
+	}
+
+	public class NativeConvert {
+		[DllImport ("foo")]
+		[Obsolete ("", true)]
+			private static extern int FromError (Error value, out Int32 rval);
+	}
+
+	public sealed class UnixMarshal {
+		[Obsolete ("Use Errno", true)]
+		public static string GetDescription (Error e)
+		{
+			return null;
+		}
+	}
+
+	public sealed class UnixDirectoryInfo {
+		[Obsolete ("Use GetEntriesEx", true)]
+		public static Dirent[] GetEntries ()
+		{
+			Dirent[] dirs = new Dirent[]{
+				Syscall.readdir (IntPtr.Zero)
+			};
+			return dirs;
+		}
+	}
+
+	class Test {
+		public static void Main ()
+		{
+		}
+	}
+
+


More information about the mono-bugs mailing list