[Mono-bugs] [Bug 348522] New: SIGABRT when a custom Binder doesn' t convert parameters correctly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Dec 13 13:25:36 EST 2007


           Summary: SIGABRT when a custom Binder doesn't convert parameters
           Product: Mono: Class Libraries
           Version: SVN
          Platform: i686
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: rkvinge at novell.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


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

class C {
        public void F (int code)

        static void Main ()
                BindingFlags flags = BindingFlags.Instance |
BindingFlags.Public | BindingFlags.InvokeMethod;
                typeof (C).InvokeMember ("F", flags, new LateBinder (), new C
(), new object [] {Missing.Value}, null, null, null);


class LateBinder : Binder {
        public override MethodBase BindToMethod (BindingFlags bindingAttr, 
                                                        MethodBase [] match, 
                                                        ref object [] args, 
                                                        ParameterModifier []
                                                        CultureInfo culture,
                                                        string [] names,
                                                        out object state)
                state = null;
                return match [0];

        public override object ChangeType (object value, Type type1,
CultureInfo culture)
                // This is obviously not correct, but still it shouldn't crash.
                return value;

        // The rest is just to please the compiler
        public override FieldInfo BindToField(System.Reflection.BindingFlags a,
System.Reflection.FieldInfo[] b, object c, System.Globalization.CultureInfo d)
                return null;

        public override void ReorderArgumentArray(ref object[] a, object b) {


        public override MethodBase SelectMethod(System.Reflection.BindingFlags
a, System.Reflection.MethodBase[] b, System.Type[] c,
System.Reflection.ParameterModifier[] d) {
                return null;

        public override PropertyInfo 
SelectProperty(System.Reflection.BindingFlags a,
System.Reflection.PropertyInfo[] b, System.Type c, System.Type[] d,
System.Reflection.ParameterModifier[] e) {
                return null;

Results in:
** ERROR **: file object.c: line 3988 (mono_object_unbox): assertion failed:

  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[]) <0x00004>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[]) <0xffffffff>
  at System.Reflection.MonoMethod.Invoke
  at System.MonoType.InvokeMember
  at C.Main () <0x000a8>
  at (wrapper runtime-invoke) C.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        mono [0x817b26f]
        /lib/libc.so.6(abort+0x101) [0xb7d3b1e1]
        /usr/lib/libglib-2.0.so.0(g_logv+0x47a) [0xb7ee43fa]
        /usr/lib/libglib-2.0.so.0(g_log+0x29) [0xb7ee4439]
        /usr/lib/libglib-2.0.so.0(g_assert_warning+0x70) [0xb7ee44b0]
        mono [0x80976d4]
        mono(mono_runtime_invoke_array+0x1bd) [0x809c65d]
        mono [0x80a4af6]
        mono(mono_runtime_exec_main+0xbb) [0x809e90b]
        mono(mono_runtime_run_main+0x173) [0x809ec03]
        mono(mono_main+0x6a9) [0x805ae39]
        mono [0x805a282]
        /lib/libc.so.6(__libc_start_main+0xe0) [0xb7d25fe0]
        mono [0x805a1f1]

Note: The code is nasty, and the crash can easily be worked around, so no hurry
on this one :)

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