[Mono-bugs] [Bug 73117][Min] New - disabling obsolete warning in one file makes it crash the compiler in another file

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 28 Feb 2005 12:25:55 -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=73117

--- shadow/73117	2005-02-28 12:25:55.000000000 -0500
+++ shadow/73117.tmp.16567	2005-02-28 12:25:55.000000000 -0500
@@ -0,0 +1,61 @@
+Bug#: 73117
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: danw@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: disabling obsolete warning in one file makes it crash the compiler in another file
+
+If you put "#pragma warning disable 612" in one file, then the
+compiler will crash if it encounters a warning 612 ("blah is obsolete")
+in another file:
+
+danw@twelve-monkeys:tmp> cat A.cs
+using System;
+ 
+[Obsolete]
+public class One { }
+ 
+#pragma warning disable 612
+ 
+public class Two {
+        private One one;
+}
+
+danw@twelve-monkeys:tmp> cat B.cs
+using System;
+ 
+public class Three {
+        public static void Main ()
+        {
+                One = new One ();
+        }
+}
+
+danw@twelve-monkeys:tmp> mcs -o test.exe A.cs B.cs
+ 
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x0010e> Mono.CSharp.Report+WarningMessage:IsEnabled (Int32 code)
+in <0x00013> Mono.CSharp.Report+WarningMessage:Print (Int32 code,
+System.String location, System.String text)
+in <0x000af> Mono.CSharp.Report+AbstractMessage:Print (Int32 code, Location
+location, System.String text)
+in <0x0001c> Mono.CSharp.Report+WarningMessage:Print (Int32 code, Location
+location, System.String text)
+in <0x0004a> Mono.CSharp.Report:Warning (Int32 code, Location loc,
+System.String format, System.Object[] args)
+in <0x000cd> Mono.CSharp.AttributeTester:Report_ObsoleteMessage
+(System.ObsoleteAttribute oa, System.String member, Location loc)
+in <0x00033> Mono.CSharp.Expression:CheckObsoleteAttribute (System.Type type)
+...