public static void Run(int icm, object manualRun = null) { try { SALsA.AddInstance(icm); SALsA.GetInstance(icm).ICM.PostICMHeader(); // We do not need to keep the analyzer in memory, for now. _ = manualRun == null ? new Analyzer(icm) : new Analyzer(icm, manualRun); SALsA.GetInstance(icm)?.TaskManager.WaitAllTasks(); } catch (Exception ex) { Log.Critical("Main failed !"); Log.Exception(ex); SALsA.GetInstance(icm)?.TaskManager.WaitAllTasks(); try { Log.Information("ICM State : {0}", Utility.ObjectToJson(SALsA.GetInstance(icm).ICM)); } catch { } try { Log.Information("ICM SALsA : {0}", Utility.ObjectToJson(SALsA.GetInstance(icm))); } catch { } //throw ex; } finally { SALsA.GetInstance(icm)?.ICM.EmptyMessageQueue(); if (SALsA.GetInstance(icm)?.State == SALsAState.Running) { if (SALsA.GetInstance(icm)?.ICM?.SAS != null) { SALsA.GetInstance(icm).State = SALsAState.Done; } else { SALsA.GetInstance(icm).State = SALsAState.UnknownException; } } BlobStorageUtility.UploadLog(icm); SALsA.GetInstance(icm)?.RefreshTable(); } }