protected override void OnStart(string[] args) => Task.Run(async() => { // Normally it'd make sense to use already provided string[] args parameter above // However, that one doesn't seem to work when ASF is started as a service, it's always null // Therefore, we will use Environment args in such case string[] envArgs = Environment.GetCommandLineArgs(); await Init(envArgs).ConfigureAwait(false); ShutdownResetEvent.Wait(); Stop(); });
protected override void OnStart(string[] args) => Task.Run(() => { Init(args); ShutdownResetEvent.Wait(); Stop(); });