Use static functions in runtime code (rosyln)
Hello,
I'm trying to import a static class (
using static namespace.class
) into rosyln executing code (await CSharpScript.EvaluateAsync(code)
).
In this example, the function Query is a static function in the running assembly.
Currently I'm setting the default code options in the startup function:
But this doesn't seem to work. The function isn't recognized, and importing the namespace in the executing code fails in the same way (namespace/assembly not found).
Is there a way to import a static class into the memory-runtime?1 Reply
Okay I found the issue. I just misunderstood how
ScriptOptions.Default
worked. I thought it set the default when using WithImport
, but it just returns the options object with the imports (which makes perfect sense now I think about it).