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

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 7 03:15:23 EDT 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=553675#c5


--- Comment #5 from olivier dufour <olivier.duff at gmail.com> 2011-10-07 07:15:21 UTC ---
I have done a test case on windows pc and here is the result:
(I will test it on linux later

    public class foo<T>
    {
        public object test
        {
            get { return null;}
        }
    }

    public class bar : foo<object>
    {

    }

public class Test 
{
    public static void Main(string[] args)
    {
            PropertyInfo p = typeof(bar).GetProperty ("test");
            object toto = p.GetValue (new bar (),new object [] {});
            //is ok
            PropertyInfo p = typeof(foo<>).GetProperty ("test");
            object toto = p.GetValue (new bar (),new object [] {});
            //is ko
            //throw System.InvalidOperationException: Late bound operations
cannot be performed on types or methods for which ContainsGenericParameters is
true.

    }
}

-- 
Configure bugmail: https://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