[Mono-bugs] [Bug 336936] New: Type. InvokeMember should throw ArgumentException when no operation is specified in bindingflags

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 25 17:54:23 EDT 2007


           Summary: Type.InvokeMember should throw ArgumentException when no
                    operation is specified in bindingflags
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at ximian.com
          Found By: ---

When the bindingflags specified in Type.InvokeMember do not contain any of the
following flags then an ArgumentException must be thrown:

To reproduce, compile and run the following code snippet:

using System;
using System.Reflection;

class Program
        private const BindingFlags DefaultBindingFlags = BindingFlags.Public |

        static void Main ()
                Type type = typeof (Program);
                type.InvokeMember ("Run", DefaultBindingFlags,
                null, null, new object [0]);

        static void Run ()

Expected result:

Unhandled Exception: System.ArgumentException: Must specify binding flags
bing the invoke operation required (BindingFlags.InvokeMethod CreateInstance
Field SetField GetProperty SetProperty).
Parameter name: bindingFlags
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags,
nder binder, Object target, Object[] providedArgs, ParameterModifier[]
, CultureInfo culture, String[] namedParams)
   at Program.Main()

Actual result:

Member is not invoked, but no ArgumentException is thrown.

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