in csharp/Functions.Client/FunctionsDllClient.cs [38:98]
static void Main(string[] args)
{
var startTime = DateTime.Parse(args.Length > 0 && args[0].Length > 10 ? args[0] : DateTime.Now.AddSeconds(2).ToString());
Console.WriteLine("Will start execution on: " + startTime);
Thread.Sleep((int)Math.Max((startTime - DateTime.Now).TotalMilliseconds, 100.0));
bool failed = false;
bool wait = args.Any(x => (x.Contains("-w") || x.Equals("wait")));
try
{
InvokeVersion(1);
} catch(Exception e)
{
Console.WriteLine(e);
failed = true;
}
try
{
InvokeVersion(2);
}
catch (Exception e)
{
Console.WriteLine(e);
failed = true;
}
// On Linux, you can truncate or modify already loaded native library and crash the application.
// Apparently, nothing will protect from this behavior if you have the necessary access rights.
//try
//{
// new FileStream("/tmp/_/1.0.0.0/64/libFunctionsNative1-0-0.so", FileMode.Create, FileAccess.ReadWrite).Dispose();
//}
//catch {}
//Thread.Sleep(4000);
Console.WriteLine($"{Process.GetCurrentProcess().Id}: Again.. ");
try
{
InvokeVersion(1);
}
catch (Exception e)
{
Console.WriteLine(e);
failed = true;
}
try
{
InvokeVersion(2);
}
catch (Exception e)
{
Console.WriteLine(e);
failed = true;
}
if (failed || wait)
Console.ReadKey(true);
}