public void DoWork() { if (!LoadConfigSetting()) { Log.Error("Error while working with config.json file in application folder"); Environment.Exit(-1); } CreateTables(); foreach (EventLogProcessor IB in ListOfProcessors) { try { IB.GetInfobaseIDFromDatabase(); } catch (Exception ex) { Log.Error(ex, $"Error occurred while getting infobase ID from target database ({IB.InfobaseName})"); continue; } try { var Thead = new Thread(IB.DoWork) { IsBackground = false }; Thead.Start(); ArrayThread.Add(Thead); //------------------------------------- //IB.DoWork(); } catch (Exception ex) { Log.Error(ex, $"Error occurred while starting new thread ({IB.InfobaseName})"); } } }