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

https://bugzilla.novell.com/show_bug.cgi?id=471359#c3


Joe Mistachkin <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from Joe Mistachkin <[email protected]> 2010-12-07 13:49:11 
UTC ---
I just ran into this bug as well.  Here is another simple example:

using System;
using System.Globalization;
using System.Reflection;

namespace ConsoleApplication1
{
    class Program
    {
        private class CustomBinder : Binder
        {
            public override object ChangeType(
                object value,
                Type type,
                CultureInfo culture
                )
            {
                Console.WriteLine(
                    "ChangeType INVOKED: value = {0}, valueType = {1}, " +
                    "type = {2}", value, (value != null) ?
                        value.GetType() : null, type);

                return Type.DefaultBinder.ChangeType(value, type, culture);
            }

            ///////////////////////////////////////////////////////////////////

            public override FieldInfo BindToField(
                BindingFlags bindingAttr,
                FieldInfo[] match,
                object value,
                CultureInfo culture
                )
            {
                throw new NotImplementedException();
            }

            ///////////////////////////////////////////////////////////////////

            public override MethodBase BindToMethod(
                BindingFlags bindingAttr,
                MethodBase[] match,
                ref object[] args,
                ParameterModifier[] modifiers,
                CultureInfo culture,
                string[] names,
                out object state
                )
            {
                throw new NotImplementedException();
            }

            ///////////////////////////////////////////////////////////////////

            public override void ReorderArgumentArray(
                ref object[] args,
                object state
                )
            {
                throw new NotImplementedException();
            }

            ///////////////////////////////////////////////////////////////////

            public override MethodBase SelectMethod(
                BindingFlags bindingAttr,
                MethodBase[] match,
                Type[] types,
                ParameterModifier[] modifiers
                )
            {
                throw new NotImplementedException();
            }

            ///////////////////////////////////////////////////////////////////

            public override PropertyInfo SelectProperty(
                BindingFlags bindingAttr,
                PropertyInfo[] match,
                Type returnType,
                Type[] indexes,
                ParameterModifier[] modifiers
                )
            {
                throw new NotImplementedException();
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public void TestMethod(string value)
        {
            Console.WriteLine(value);
        }

        ///////////////////////////////////////////////////////////////////////

        static void Main(string[] args)
        {
            Binder binder = new CustomBinder();
            Program program = new Program();

            MethodInfo methodInfo = typeof(Program).GetMethod("TestMethod");

            methodInfo.Invoke(
                program, BindingFlags.Default, binder,
                new object[] { "foobar" }, null);

            Console.WriteLine("done");
            Console.ReadKey();
        }
    }
}

Expected results:

foobar
done

Actual results:

ChangeType INVOKED: value = foobar, valueType = System.String, type =
System.String
foobar
done

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to