33 questions
1
vote
2
answers
426
views
Logic Apps inline C# script step just stopped working with no code change
Last 10 entries (specifically all those in last 4 days) show as failed in Run History and have this message in the "Execute CSharp Script Code" action
InvokeFunctionFailed
The function '...
1
vote
0
answers
191
views
How do I pass a CSharpScript variable a value or object instance before I run it?
Using CSharpScript, is there a way I can pass a variable a value or object instance before the script is run?
it seems like using StateScript will allow me to set a script variable using the following....
0
votes
1
answer
185
views
Pass array as input parameter in CSharpScript
I try to run method by CSharpScript.
Method:
public class TaskSolution
{
public int[] Calculate(int[] inputValue)
{
return inputValue;
}
}
I tried this solution:
var script = ...
0
votes
3
answers
2k
views
Roslyn CSharpScript EvaluateAsync Returns False When Statement Should Be True
I am just learning how to use Roslyn and I have a script like this:
var id = Guid.NewGuid();
string condition = $@"new List<Guid> {{ new Guid(""{Guid.NewGuid()}""), new ...
0
votes
1
answer
388
views
Roslyn/CSharpScript and VSCode as editor
I have to give my clients the ability to edit scripts with VS Code.
The problem.. when my software call:
CSharpScript.EvaluateAsync<int>(code, opt, host);
host object, should be passed to the ...
2
votes
1
answer
957
views
FileLoadException when running C# script with .NET Core 3.1
I wrote the following C# script (HelloWorld.csx file):
#! "netcoreapp3.1"
#r "nuget: System.Text.Encoding.CodePages, 5.0.0"
public class Script
{
public static void Run()
{...
1
vote
1
answer
3k
views
Dynamically Execute C# with Microsoft.CodeAnalysis.CSharp.Scripting is failing
I have a requirement of executing a C# class in the string format and populate an object with the properties of that class. To achieve the requirement I was doing a POC and that's failed.
Following ...
2
votes
1
answer
518
views
Roslyn CSharpScript and DateTime Reference error
error CS0246: The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)
When running the following code:
public string ...
0
votes
1
answer
854
views
c# scripting Roslyn session not accepting reference
I am trying to execute some arbitrary c sharp script in a c# .net application, but I have tried numerous ways to add an external file reference of an assembly and it never seems to work complaining I ...
4
votes
1
answer
2k
views
System.IO.FileNotFoundException when using CSharpScript in Blazor wasm
I'm trying to use CSharpScript in a Blazor wasm application, testing with a simple EvaluateAsync:
var result = await CSharpScript.EvaluateAsync<int>("1 + 1");
Throws: System.IO....
1
vote
1
answer
82
views
SharpScript .ss file works to connect to database, but same code doesn't work when served to local web-browser?
I have a SharpScript .ss script file with some small code that polls a database and formats things to display. The output is getting too unruly for command line output so I wanted to generate html and ...
1
vote
1
answer
3k
views
CSharpScript: Dynamic script parameter names
I'm trying to use Roslyn to execute C# code that is defined by the user at runtime, similar to this example:
public class Globals
{
public int X;
public int Y;
}
var globals = new Globals { X ...
0
votes
1
answer
868
views
DateTime in roslyn CSharpScript returns 'expecting ;'
Use of DateTime within the roslyn CSharpScript evaluator returns error code 'Expected ;' while strings work fine.
Using Visual Studio 2019 with Microsoft.CodeAnalysis.Common and Microsoft....
4
votes
0
answers
879
views
How to resolve dependency issues with C# script csx file in visual studio code?
I am trying to create an azure function program with a service bus queue trigger template using a csx file. But I am having issues resolving dependencies. To be honest, i am very confused about the ...
1
vote
0
answers
300
views
How to interrupt user-written script?
Trying to run script (using Roslyn Scripting API):
var source = "while(true) { }";
return CSharpScript.EvaluateAsync(source).Result;
It will run forever. How to interrupt it?
I don't mind using ...
4
votes
0
answers
551
views
Managing security and resource usage of C# Scripts
My client wants to add the ability for users to define small scripts that can be used to run various calculations in a pre-existing web application. Currently, we're exploring using CSharpScripts in ...
4
votes
1
answer
1k
views
How to cancel CSharpScript.RunAsync
How can I stop RunAsync?
CancellatioTokenSource cts = new CancellationTokenSource();
//I thought that it's must work, but it don't
var script = CSharpScript.Create(code: someCode);
await script....