[Mono-bugs] [Bug 553675] New: PropertyInfo.GetValue() throws InvalidCastException instead of TargetException when supplied invalid argument

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 9 00:47:07 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=553675


           Summary: PropertyInfo.GetValue() throws InvalidCastException
                    instead of TargetException when supplied invalid
                    argument
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86-64
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: novell at nathan.qgl.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.14)
Gecko/2009090217 Ubuntu/9.04 (jaunty) Firefox/3.0.14

According to
http://go-mono.org/docs/index.aspx?link=M%3aSystem.Reflection.PropertyInfo.GetValue(System.Object%2cSystem.Object[])

When PropertyInfo.GetValue(object, object[]) is supplied an instance via the
first argument that does not implement the reflected property, a
TargetException should be thrown.

When targetting Mono 2.0 (build with gmcs) on Mono 2.4.2.3 InvalidCastException
is thrown instead. 

I have not tested other versions of Mono

Reproducible: Always

Steps to Reproduce:
Compile  the attached test case to a command-line exe and run.

gmcs -t:exe GetValueTestCase.cs
Actual Results:  
Progrma prints out

System.InvalidCastException

Expected Results:  
According to documentation, should print out

System.Reflection.TargetException

Running the program on Windows prints this.

When targetting  Mono 1.0 (with mcs instead of gmcs) the correct output is
seen.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list