[Mono-bugs] [Bug 38291][Min] Changed - Strange Reflection crash.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 25 Feb 2003 05:50:12 -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 lupus@ximian.com.


--- shadow/38291	Sun Feb 23 02:28:48 2003
+++ shadow/38291.tmp.27796	Tue Feb 25 05:50:12 2003
@@ -10,13 +10,12 @@
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: pt99par@student.bth.se               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 Summary: Strange Reflection crash.
 Please fill in this template when reporting a bug, unless you know what you
 are doing.
 Description of Problem:
@@ -129,6 +128,49 @@
 Mono.CSharp.Driver:Main (string[])
 The MethodBase.get_IsStatic method in the source code nowhere makes a
 call to GetValue on a Property, so this is very strange to me.
+------- Additional Comments From lupus@ximian.com  2003-02-25 05:50 -------
+This looks like a compiler bug. In the mono runtime it may be that we
+don't enforce some constraint and the bug manifests itself with
+strange nehaviour. For example I get two different error messages if
+compiling with mini or mono (ie I don't get the exception reported above):
+$ mcs broken.cs
+broken.cs(5) error CS0176: Static member `Item' cannot be accessed
+with an instance reference, qualify with a type name instead
+$ monomcs broken.cs
+broken.cs(5) error CS0654: Method
+`System.Collections.Specialized.NameValueCollection.Item()' is
+referenced without parentheses
+As another data point, when using the MS runtime to compile that code
+it gets an exception:
+Unhandled Exception: System.InvalidCastException: At least one element
+in the source array could not be cast down to the destination array type.
+   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array
+destinationArray, Int32 destinationIndex, Int32 length)
+   at System.Array.CopyTo(Array array, Int32 index)
+   at Mono.CSharp.MethodGroupExpr..ctor(MemberInfo[] mi, Location l)
+in d:\mcs\mcs\ecore.cs:line 3781
+   at Mono.CSharp.Expression.MemberLookup(EmitContext ec, Type
+container_type, Type qualifier_type, Type queried_type, String name,
+MemberTypes mt, BindingFlags bf, Location loc) in
+d:\mcs\mcs\ecore.cs:line 565
+   at Mono.CSharp.Expression.MemberLookupFinal(EmitContext ec, Type
+qualifier_type, Type queried_type, String name, MemberTypes mt,
+BindingFlags bf, Location loc) in d:\mcs\mcs\ecore.cs:line 629   at
+Mono.CSharp.Expression.MemberLookupFinal(EmitContext ec, Type
+qualifier_type, Type queried_type, String name, Location loc) in
+d:\mcs\mcs\ecore.cs:line 616
+   at Mono.CSharp.MemberAccess.DoResolve(EmitContext ec, Expression
+right_side, ResolveFlags flags) in d:\mcs\mcs\expression.cs:line 6192
+   at Mono.CSharp.MemberAccess.DoResolve(EmitContext ec) in
+d:\mcs\mcs\expression.cs:line 6219
+I put martin on the cc line because he seems to be the author of the
+cast checking code for Array.Copy() and he was also involved in the
+MemberLookup in mcs, so he might have some clues about both bugs.