Csharp invoke code error

Hi everyone,

I’m trying to execute csharp code using invoke activity but it throws this error

the code im using

class Program
{
static void Main(string args)
{
Method1();
Method2();
Console.ReadKey();
}
public static async Task Method1()
{
await Task.Run(() =>
{
for (int i = 0; i < 100; i++)
{
// Do something
Task.Delay(100).Wait();
}
});
}
public static void Method2()
{
for (int i = 0; i < 25; i++)
{
// Do something
Task.Delay(100).Wait();
}
System.Environment.Exit(0);
}
}

Please can anyone tell me what is this error because its running fine in VS

Hi,

In Invoke Code activity, we need to write code like content of a method.
The following sample might helps you.

Regards,