http://bugzilla.novell.com/show_bug.cgi?id=590140
http://bugzilla.novell.com/show_bug.cgi?id=590140#c0 Summary: Evaluator fails to evaluate expression to create Generic class instance Classification: Mono Product: Mono: Compilers Version: 1.2.0 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5 I am trying to evaluate an expression to create generic class which is inside an assembly called DynamicLibrary- I have created, a class in question is the class named Fx<T> and is contained in DynamicLibrary.Function32 Namespace. This class has a black-hole constructor Fx(params object[] objs) which can accept any arguments. Here is my code: internal static class CSharp { private static string sb = @" using System; using System.Collections.Generic; using System.Collections; using DynamicLibrary; using DynamicLibrary.Math32; using DynamicLibrary.Math32.Arithmetic; using DynamicLibrary.Math32.Statistics; using DynamicLibrary.Function32; using DynamicLibrary.Boolean32; using DynamicLibrary.DateTime32; using DynamicLibrary.String32; using DynamicLibrary.Data32;"; public static object Evaluate(string Expression) { try { Evaluator.Run(sb); Evaluator.ReferenceAssembly(Assembly.GetExecutingAssembly()); //Evaluator.LoadAssembly("DynamicLibrary"); return Evaluator.Evaluate(Expression + ";"); } catch(Exception ex) { return null; } } } Here is what I try to get: object o= CSharp.Evaluate("new DynamicLibrary.Function32.Fx<System.Double>(1,2,3)") And here is the exception details: {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"} [System.BadImageFormatException]: {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"} Data: {System.Collections.ListDictionaryInternal} HelpLink: null InnerException: null Message: "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)" Source: "interactive1" StackTrace: " at Class0.Host(Object& $retval)\r\n at Mono.CSharp.Evaluator.Evaluate(String input, Object& result, Boolean& result_set) in D:\\Mukesh\\GMCS C#\\eval.cs:line 301\r\n at Mono.CSharp.Evaluator.Evaluate(String input) in D:\\Mukesh\\GMCS C#\\eval.cs:line 357\r\n at DynamicLibrary.Compiler32.CSharp.Evaluate(String Expression) in D:\\Mukesh\\Data Organizer C#\\Dynamic Library\\Compiler32.cs:line 47" TargetSite: {Void Host(System.Object ByRef)} Reproducible: Always Steps to Reproduce: 1. Reference any assembly which contains generic class definition 2. use Evaluator.Run ("using myassembly") 3. use Evaluator.Evaluate("new class<T>(....)") Actual Results: instead of actual class null is returned Expected Results: an instance of generic class should be returned -- 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
