[Mono-bugs] [Bug 471257] New: Inconsistent Reflection behavior with custom Binder on Mono versus .NET

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jan 30 22:49:14 EST 2009


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


           Summary: Inconsistent Reflection behavior with custom Binder on
                    Mono versus .NET
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: x86
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: joe at mistachkin.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20)
Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729)


The Eagle unit tests object-14.1, object-14.2, object-14.4, object-14.5, and
object-14.6 demonstrate an inconsistency between the Reflection implementations
on Mono and .NET.  Judging from the stack traces, it looks like Mono may not be
supplying the correct arguments to my custom Binder implementation; however, on
NET the custom IBinder implementation is not even called for these unit tests.

---- object-14.1 start

==== object-14.1 nested static/non-static type resolution FAILED
==== Contents of test case:

  object invoke System.Console.BackgroundColor ToString

---- Test generated error; Return code was: Error
---- Return code should have been one of: Ok Return
---- errorInfo: System.NullReferenceException: Object reference not set to an
instance of an object
  at Eagle._Components.Private.ScriptBinder.BindToMethod (BindingFlags
bindingAttr, System.Reflection.MethodBase[] match, System.Object[]& args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] names, System.Object&
state) [0x00000] 
  at System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] namedParameters)
[0x00000] 
  at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args)
[0x00000] 
  at Eagle._Components.Public.Value.GetNestedObject
(Eagle._Components.Public.Interpreter interpreter, System.String text,
System.AppDomain appDomain, BindingFlags bindingFlags, Boolean strict, Boolean
verbose, Boolean noCase, Boolean noNested, System.Globalization.CultureInfo
cultureInfo, Eagle._Components.Public.TypedInstance& value,
Eagle._Components.Public.Result& error, System.Exception& exception) [0x00000] 
    while executing
"object invoke System.Console.BackgroundColor ToString"
---- errorCode: NONE
==== object-14.1 FAILED
---- object-14.2 start

==== object-14.2 nested static/non-static type resolution FAILED
==== Contents of test case:

  list [catch {object invoke System.Console.GetType ToString} msg] $msg

---- Result was:
1 {System.NullReferenceException: Object reference not set to an instance of an
object
  at Eagle._Components.Private.ScriptBinder.BindToMethod (BindingFlags
bindingAttr, System.Reflection.MethodBase[] match, System.Object[]& args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] names, System.Object&
state) [0x00000] 
  at System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] namedParameters)
[0x00000] 
  at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args)
[0x00000] 
  at Eagle._Components.Public.Value.GetNestedObject
(Eagle._Components.Public.Interpreter interpreter, System.String text,
System.AppDomain appDomain, BindingFlags bindingFlags, Boolean strict, Boolean
verbose, Boolean noCase, Boolean noNested, System.Globalization.CultureInfo
cultureInfo, Eagle._Components.Public.TypedInstance& value,
Eagle._Components.Public.Result& error, System.Exception& exception) [0x00000]
}
---- Result should have been (Glob matching):
1 {System.Reflection.TargetException: Non-static method requires a target.*}
==== object-14.2 FAILED
---- object-14.3 start
++++ object-14.3 PASSED
---- object-14.4 start

==== object-14.4 nested static/non-static type resolution FAILED
==== Contents of test case:

  object invoke Eagle._Tests.Default StaticObjectProperty null
  list [catch {object invoke Eagle._Tests.Default.StaticObjectProperty 
ToString} msg] $msg

---- Result was:
1 {System.NullReferenceException: Object reference not set to an instance of an
object
  at Eagle._Components.Private.ScriptBinder.BindToMethod (BindingFlags
bindingAttr, System.Reflection.MethodBase[] match, System.Object[]& args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] names, System.Object&
state) [0x00000] 
  at System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] namedParameters)
[0x00000] 
  at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args)
[0x00000] 
  at Eagle._Components.Public.Value.GetNestedObject
(Eagle._Components.Public.Interpreter interpreter, System.String text,
System.AppDomain appDomain, BindingFlags bindingFlags, Boolean strict, Boolean
verbose, Boolean noCase, Boolean noNested, System.Globalization.CultureInfo
cultureInfo, Eagle._Components.Public.TypedInstance& value,
Eagle._Components.Public.Result& error, System.Exception& exception) [0x00000]
}
---- Result should have been (Exact matching):
1 {invalid object or type "Eagle._Tests.Default.StaticObjectProperty"}
==== object-14.4 FAILED
---- object-14.5 start

==== object-14.5 nested static/non-static type resolution FAILED
==== Contents of test case:

  object invoke Eagle._Tests.Default StaticObjectProperty foo
  object invoke Eagle._Tests.Default.StaticObjectProperty ToString

---- Test generated error; Return code was: Error
---- Return code should have been one of: Ok Return
---- errorInfo: System.NullReferenceException: Object reference not set to an
instance of an object
  at Eagle._Components.Private.ScriptBinder.BindToMethod (BindingFlags
bindingAttr, System.Reflection.MethodBase[] match, System.Object[]& args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] names, System.Object&
state) [0x00000] 
  at System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] namedParameters)
[0x00000] 
  at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args)
[0x00000] 
  at Eagle._Components.Public.Value.GetNestedObject
(Eagle._Components.Public.Interpreter interpreter, System.String text,
System.AppDomain appDomain, BindingFlags bindingFlags, Boolean strict, Boolean
verbose, Boolean noCase, Boolean noNested, System.Globalization.CultureInfo
cultureInfo, Eagle._Components.Public.TypedInstance& value,
Eagle._Components.Public.Result& error, System.Exception& exception) [0x00000] 
    while executing
"object invoke Eagle._Tests.Default.StaticObjectProperty ToString"
---- errorCode: NONE
==== object-14.5 FAILED
---- object-14.6 start

==== object-14.6 nested static/non-static type resolution FAILED
==== Contents of test case:

  $test TypeProperty $type
  list [object invoke $test.TypeProperty ToString] [object invoke 
$test.TypeProperty.BaseType ToString] $object [$type ToString]  [$baseType
ToString]

---- Test generated error; Return code was: Error
---- Return code should have been one of: Ok Return
---- errorInfo: System.NullReferenceException: Object reference not set to an
instance of an object
  at Eagle._Components.Private.ScriptBinder.BindToMethod (BindingFlags
bindingAttr, System.Reflection.MethodBase[] match, System.Object[]& args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] names, System.Object&
state) [0x00000] 
  at System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, System.String[] namedParameters)
[0x00000] 
  at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object target, System.Object[] args)
[0x00000] 
  at Eagle._Components.Public.Value.GetNestedObject
(Eagle._Components.Public.Interpreter interpreter, System.String text,
System.AppDomain appDomain, BindingFlags bindingFlags, Boolean strict, Boolean
verbose, Boolean noCase, Boolean noNested, System.Globalization.CultureInfo
cultureInfo, Eagle._Components.Public.TypedInstance& value,
Eagle._Components.Public.Result& error, System.Exception& exception) [0x00000] 
    while executing
"object invoke $test.TypeProperty ToString"
    invoked from within
"list [object invoke $test.TypeProperty ToString] [object invoke 
$test.TypeProperty.BaseType ToString] $object [$type ToString]  [$baseType
ToString]"
---- errorCode: NONE
==== object-14.6 FAILED


Reproducible: Always

Steps to Reproduce:
1. Download the "Mono-on-Unix" binaries distribution from: http://eagle.to/
2. Start the EagleShell.exe under the Mono of your choice (fails in 2.0 and
2.2)
3. Type "set argv [list -constraints monoBug]" and hit enter.
4. Type "#test object14*" and hit enter to see the failure (complete with stack
trace).

Actual Results:  
Exceptions from inside the custom Binder implementations.

Expected Results:  
The custom Binder implementation should not be called for these unit tests and
the tests should all pass.

-- 
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