I'm currently trying to upgrade a bigger CS Script environment from 3.28.x to 4.2.0.0. At the moment I'm debugging a scenario where two public static int Main(string[] args) signatures are available at the same time.
Let's say is test.cs:
//css_nuget CS-Script
//css_import script
using System;
public class My
{
public static void Main(string[] args)
{
Script.MyFunction();
}
}
And script.cs:
using System;
using System.Linq;
using System.Collections.Generic;
using static dbg; // to use 'print' instead of 'dbg.print'
using CSScriptLib;
public class Script
{
public static void MyFunction()
{
(string message, int version) setup_say_hello()
{
return ("Hello from C#", 9);
}
var info = setup_say_hello();
print(info.message, info.version);
print(Environment.GetEnvironmentVariables()
.Cast<object>());
}
public static void Main(string[] args)
{
MyFunction();
}
}
When I start cscs test.cs the script fails with:
error CS0017: Program has more than one entry point defined
In addition, I started a debug session with ccs -vs test.cs. And here some strange things showed up. The script.cs file and its main function got not renamed by CS Script. I started a small debugging step and found some issues.
The main function got renamed after importedFile.ProcessFile(); in ScriptParser.cs, but the wrong file is included in project:
Hi there,
I'm currently trying to upgrade a bigger CS Script environment from 3.28.x to 4.2.0.0. At the moment I'm debugging a scenario where two
public static int Main(string[] args)
signatures are available at the same time.Let's say is
test.cs
:And
script.cs
:When I start
cscs test.cs
the script fails with:In addition, I started a debug session with
ccs -vs test.cs
. And here some strange things showed up. The script.cs file and its main function got not renamed by CS Script. I started a small debugging step and found some issues.The main function got renamed after
importedFile.ProcessFile();
inScriptParser.cs
, but the wrong file is included in project:Here I'm not sure if my patch is correct but at least it worked in my case ;-)
Regards, Florian