[Mono-list] Mono.CSharp.Evaluator: Error with x.GetType()

lukebuehler lukas.buehler at gmail.com
Fri Jan 25 15:39:12 UTC 2013


This is regarding Mono 3.0.1: Mono.CSharp.Evaluator

When I instantiate an Evaluator and then then evaluate following input:

    var context = new CompilerContext(new CompilerSettings(), new
    var evaluator = new Evaluator(context);
    evaluator.DescribeTypeExpressions = true;

    object result = null;
    bool set = false;
    evaluator.Evaluate("class A{ public int X;}", out result, out set);

    //this works
    evaluator.Evaluate("var a = new A();a.GetType();", out result, out set);

    //this doesnt work
    evaluator.Evaluate("var a = new A();", out result, out set);
    //Error here:
    evaluator.Evaluate("a.GetType();", out result, out set);

I get an error in the second last line:

System.IO.FileNotFoundException: Could not load file or assembly 'eval-0,
Version=, Culture=neutral, PublicKeyToken=null' o
r one of its dependencies. The system cannot find the file specified.
File name: 'eval-0, Version=, Culture=neutral, PublicKeyToken=null'
   at <InteractiveExpressionClass>.Host(Object& $retval)
   at Mono.CSharp.Evaluator.Evaluate(String input, Object& result, Boolean&
   at MonoEval.Program.Main(String[] args) in
C:\Users\Luke\Dev\Samples\MonoEval\Program.cs:line 30

=== Pre-bind state information ===
LOG: User = wall-e\Luke
LOG: DisplayName = eval-0, Version=, Culture=neutral,
LOG: Appbase = file:///C:/Users/Luke/Dev/Samples/MonoEval/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Attempting download of new URL
LOG: Attempting download of new URL
LOG: Attempting download of new URL
LOG: Attempting download of new URL

The last lines works if evaluate the code in the csharp interactive console
that comes with mono but NOT when I have my own instance of evaluator.

Any ideas why that might be? Is this a bug?


View this message in context: http://mono.1490590.n4.nabble.com/Mono-CSharp-Evaluator-Error-with-x-GetType-tp4658286.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list