[Mono-bugs] [Bug 58381][Min] New - Type.GetProperty(string) returns null on ambiguity instead of throwing exception
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 12 May 2004 11:06:33 -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 t6@pobox.com.
http://bugzilla.ximian.com/show_bug.cgi?id=58381
--- shadow/58381 2004-05-12 11:06:33.000000000 -0400
+++ shadow/58381.tmp.5554 2004-05-12 11:06:33.000000000 -0400
@@ -0,0 +1,85 @@
+Bug#: 58381
+Product: Mono: Compilers
+Version: unspecified
+OS:
+OS Details: Fedora Core 1, official beta 1 RPMS
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: t6@pobox.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Type.GetProperty(string) returns null on ambiguity instead of throwing exception
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When calling GetProperty("Item") on a Type for a class with an
+overloaded indexer, null is returned instead of throwing
+an AmbiguousMatchException as per .NET 1.1 docs and MS .NET 1.1 behaviour.
+
+Steps to reproduce the problem:
+1. compile test program included
+2. run it
+3.
+
+Actual Results:
+null returned
+
+Expected Results:
+AmbiguousMatchException thrown
+
+How often does this happen?
+always
+
+Additional Information:
+A test program PropTest.cs -
+
+using System;
+using System.Reflection;
+
+namespace test
+{
+
+ public class MultiIndexer
+ {
+ public string this[int i]
+ {
+ get { return i.ToString(); }
+ }
+
+ public string this[double d]
+ {
+ get { return d.ToString(); }
+ }
+
+
+ }
+
+
+ public class PropTest
+ {
+
+ public static void Main()
+ {
+ Type type = typeof(MultiIndexer);
+ PropertyInfo pi = type.GetProperty("Item");
+ if (pi==null)
+ Console.WriteLine("got null (not found), should have thrown an
+AmbiguousMatchException");
+ else
+ Console.WriteLine("got pi="+pi);
+
+ // try using them (works fine)
+ MultiIndexer m = new MultiIndexer();
+ Console.WriteLine("int index 1 = "+m[1]);
+ Console.WriteLine("double index 2.2 = "+m[2.2]);
+ }
+ }
+
+}