[Mono-bugs] [Bug 625367] New: MethodCallExpression of Enum fail to invoke

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jul 25 02:45:36 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=625367

http://bugzilla.novell.com/show_bug.cgi?id=625367#c0


           Summary: MethodCallExpression of Enum fail to invoke
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: sabro at webkai.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Fail to invoke method call expression only enum type.


Code:

using System;
using System.Linq.Expressions;

class MainClass
{
    public static void Main (string[] args)
    {
        Expression<Func<object>> valueTypeExp = () => 1.ToString();
        Expression<Func<object>> stringExp = () => "1".ToString();
        Expression<Func<object>> objectExp = () => new object().ToString();
        Expression<Func<object>> enumExp = () => TypeCode.Boolean.ToString();

        Console.WriteLine(valueTypeExp.Compile().DynamicInvoke());
        Console.WriteLine(stringExp.Compile().DynamicInvoke());
        Console.WriteLine(objectExp.Compile().DynamicInvoke());
        Console.WriteLine(enumExp.Compile().DynamicInvoke());
    }
}


Results:

1
1
System.Object

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. ---> System.NullReferenceException:
Object reference not set to an instance of an object
at (wrapper dynamic-method)
System.Runtime.CompilerServices.ExecutionScope.lambda_method
(System.Runtime.CompilerServices.ExecutionScope) <0x0001c>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[],System.Exception&) <0x00068>
at System.Reflection.MonoMethod.Invoke
(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
<0x0017f>

  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[]
parameters) [0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in
<filename unknown>:0 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args)
[0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in
<filename unknown>:0 
  at MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 



This is running on .NET without problems. But in mono, error occurred like
this.

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