Skip to content

Cannot use ExpandoObject as 'globals' parameter for Script.Run() #3194

@Stmated

Description

@Stmated

How to reproduce:

var script = CSharpScript.Create("a + b");

dynamic expando = new ExpandoObject();
var dictionary = (IDictionary<String, Object>) expando;
dictionary.Add("a", 3);
dictionary.Add("b", 4);
script.Run(expando);

Gives error message:
The name 'b' does not exist in the current context

Is there another, recommended way of giving a dynamically built object as the globals parameter to the script?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions