Skip to content

Script.Evaluator.Eval() exception #428

@kgwood39

Description

@kgwood39

Running under the .net framework, this simple example:
int sum = CSScript.RoslynEvaluator.Eval("6 + 3");

is creating the following error:
CSScriptLib.CompilerException
HResult=0x80131600
Message=<script>(1,1): error CS0518: Predefined type 'System.Object' is not defined or imported
error CS0518: Predefined type 'System.Object' is not defined or imported
error CS0518: Predefined type 'System.Threading.Tasks.Task`1' is not defined or imported
error CS0400: The type or namespace name 'System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be found in the global namespace (are you missing an assembly reference?)

<script>(0,1): error CS0518: Predefined type 'System.Object' is not defined or imported error CS0518: Predefined type 'System.Object' is not defined or imported <script>(1,1): error CS0518: Predefined type 'System.Int32' is not defined or imported <script>(1,5): error CS0518: Predefined type 'System.Int32' is not defined or imported error CS0518: Predefined type 'System.Attribute' is not defined or imported error CS0518: Predefined type 'System.Attribute' is not defined or imported error CS0518: Predefined type 'System.Int32' is not defined or imported error CS0656: Missing compiler required member 'System.AttributeUsageAttribute..ctor' error CS0656: Missing compiler required member 'System.AttributeUsageAttribute.AllowMultiple' error CS0656: Missing compiler required member 'System.AttributeUsageAttribute.Inherited' Source=CSScriptLib StackTrace: at CSScriptLib.RoslynEvaluator.Compile(String scriptText, String scriptFile, CompileInfo info) in C:\Users\kewoo\source\repos\CSScript\cs-script-master\cs-script-master\src\CSScriptLib\src\CSScriptLib\Evaluator.Roslyn.cs:line 633 at CSScriptLib.EvaluatorBase`1.CompileCode(String scriptText, String scriptFile, CompileInfo info) in C:\Users\kewoo\source\repos\CSScript\cs-script-master\cs-script-master\src\CSScriptLib\src\CSScriptLib\EvaluatorBase.cs:line 241 at CSScriptLib.EvaluatorBase`1.CompileCode(String scriptText, CompileInfo info) in C:\Users\kewoo\source\repos\CSScript\cs-script-master\cs-script-master\src\CSScriptLib\src\CSScriptLib\EvaluatorBase.cs:line 175 at CSScriptLib.RoslynEvaluator.Eval(String scriptText) in C:\Users\kewoo\source\repos\CSScript\cs-script-master\cs-script-master\src\CSScriptLib\src\CSScriptLib\Evaluator.Roslyn.cs:line 754 at ConsoleApp1.Program.Test_Roslyn() in C:\Users\kewoo\source\repos\CSScript\cs-script-master\cs-script-master\src\CSScriptLib\src\Client.NET-Framework (Roslyn+CodeDom)\Program.cs:line 80 at ConsoleApp1.Program.main(String[] args) in C:\Users\kewoo\source\repos\CSScript\cs-script-master\cs-script-master\src\CSScriptLib\src\Client.NET-Framework (Roslyn+CodeDom)\Program.cs:line 27 at ConsoleApp1.Program.Main(String[] args) in C:\Users\kewoo\source\repos\CSScript\cs-script-master\cs-script-master\src\CSScriptLib\src\Client.NET-Framework (Roslyn+CodeDom)\Program.cs:line 21

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions