zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
449 stars 86 forks source link

Bug: full Namespace in method #11

Closed vzsoft closed 7 years ago

vzsoft commented 7 years ago

Hi

i got error this code:

    class Program
    {
        public static void test(Type type)
        {
        }

        static void Main(string[] args)
        {
            var context = new EvalContext();
            context.RegisterType(typeof(System.Collections.Generic.Dictionary<, >));
            context.RegisterType(typeof(System.Collections.Generic.List<>));
            context.RegisterType(typeof(Program));
            context.RegisterStaticMember(typeof(Program));
            context.RegisterType(typeof(string));
            var lst = typeof(System.Collections.Generic.Dictionary<System.String, System.String>);
            //Error Line:
            var xx2 = context.Compile<Func<System.Collections.Generic.List<System.String>, object>>(@"
                Program.test(typeof(System.Collections.Generic.List<System.String>));
                return null;", "input");
      }
}
JonathanMagnan commented 7 years ago

Hello @vzsoft ,

Thank you for reporting, we successfully reproduced this issue.

We hope to release a fix very soon.

Best Regards,

Jonathan

JonathanMagnan commented 7 years ago

Hello @vzsoft ,

The v2.1.14 has been released (release note) https://www.nuget.org/packages/Z.Expressions.Eval/

Full namespace should now work correctly with typeof keyword or in similar scenario.

Let me know if the issue is fixed.

Best Regards,

Jonathan

vzsoft commented 7 years ago

Thank you