[Mono-bugs] [Bug 61926][Wis] New - Incorrect compiler error message

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 25 Jul 2004 15:29:20 -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 mmorano@mikeandwan.us.

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

--- shadow/61926	2004-07-25 15:29:20.000000000 -0400
+++ shadow/61926.tmp.22098	2004-07-25 15:29:20.000000000 -0400
@@ -0,0 +1,102 @@
+Bug#: 61926
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mmorano@mikeandwan.us               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Incorrect compiler error message
+
+Description of Problem:
+
+When compiling an application with errors, mcs does not always generate the
+best error messages.
+
+Steps to reproduce the problem:
+1. create test.cs, and paste in the following code:
+
+using System;
+using System.Xml;
+using System.Xml.Schema;
+
+namespace Test
+{
+    public class Test
+    {
+        public static int Main(string[] args)
+        {
+            Test test = new Test();
+            test.Run();
+            return 0;
+        }
+
+        public void Run()
+        {
+            XmlTextReader reader = new XmlTextReader("/dev/null");
+
+            // NOTE: the following line is not correct on purpose.  this 
+            //       exposes the incorrect error message in mcs.  the proper
+            //       error message should reflect the delegate, not the reader.
+            XmlSchema xs = XmlSchema.Read(reader, 
+                                          this.ValidationHandler);
+
+            // CORRECT CODE:
+            // XmlSchema xs = XmlSchema.Read(reader,
+            //   new ValidationEventHandler(this.ValidationHandler));
+        }
+
+
+        public void ValidationHandler(object sender, ValidationEventArgs e)
+        {
+            Console.WriteLine("got here");
+        }
+    }
+}
+
+
+
+2. now try to compile with:
+
+mcs -r:System.dll -r:System.Xml.dll -target:exe -out:test.exe test.cs
+
+
+Actual Results:
+
+Code does not compile with the following error messages:
+
+test.cs(24) error CS1502: The best overloaded match for method
+'System.Xml.Schema.XmlSchema System.Xml.Schema.XmlSchema.Read
+(System.IO.TextReader, System.Xml.Schema.ValidationEventHandler)' has some
+invalid arguments
+test.cs(24) error CS1503: Argument 0: Cannot convert from
+'System.Xml.XmlTextReader' to 'System.IO.TextReader'
+test.cs(24) error CS1501: No overload for method `Read' takes `2' arguments
+test.cs(24) error CS8006: Could not find any applicable function for this
+argument list
+Compilation failed: 4 error(s), 0 warnings
+
+
+
+Expected Results:
+
+Code not to compile, but with error messages indicating that the second
+parameter is not correct.  The error message stated makes it look as though
+the XmlTextReader instance is not a valid first argument to the method, but
+ it is.  The problem is due to the improper second argument.
+
+
+How often does this happen? 
+
+always
+
+
+Additional Information: