I've got a problem with a .NET Core 2.2 console application. I want to start an console app with an static array. This one connects to an TCP/IP partner.
On start up, I start an second console application, which should use the same static array, and the same connection as the first console application. I want to split both apps, cause it is an 'option package'. Both apps are running as background services with timed async functions. Both apps share the same namespace and are configured in the same project. The child app have an dependency of the parent app.
Until now, I can start both apps in the same console (as child-process), but the child-console can't use the static array.
How can I solve it?
Here is my Program.cs Main Method:
static async Task Main(string[] args) {
Portal_Connect.PLC = new Class_PLC[11];
if ((Configuration.Diagnostic))
{
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "dotnet ",
Arguments = Directory.GetCurrentDirectory() + \\Diagnostic.dll",
WorkingDirectory = Directory.GetCurrentDirectory(),
UseShellExecute = false,
RedirectStandardOutput = false,
RedirectStandardError = false,
CreateNoWindow = false
}
};
process.Start();
process.PriorityClass = ProcessPriorityClass.High;
process.ProcessorAffinity = (IntPtr)6;
}
}