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

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


Hi,

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
ConsoleReportPrinter());
    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);
    Console.WriteLine(result);

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


I get an error in the second last line:

System.IO.FileNotFoundException: Could not load file or assembly 'eval-0,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' o
r one of its dependencies. The system cannot find the file specified.
File name: 'eval-0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
   at <InteractiveExpressionClass>.Host(Object& $retval)
   at Mono.CSharp.Evaluator.Evaluate(String input, Object& result, Boolean&
result_set)
   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=0.0.0.0, Culture=neutral,
PublicKeyToken=null
 (Fully-specified)
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
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///C:/Users/Luke/Dev/Samples/MonoEval/bin/Debug/eval-0.DLL.
LOG: Attempting download of new URL
file:///C:/Users/Luke/Dev/Samples/MonoEval/bin/Debug/eval-0/eval-0.DLL.
LOG: Attempting download of new URL
file:///C:/Users/Luke/Dev/Samples/MonoEval/bin/Debug/eval-0.EXE.
LOG: Attempting download of new URL
file:///C:/Users/Luke/Dev/Samples/MonoEval/bin/Debug/eval-0/eval-0.EXE.


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?

Thank
-luke





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