private void Run() { if (_Root == null) { InvokeRuntimeValidationError(new List <ErrorWithPath>(1) { new ErrorWithPath(null, "Model System Root not found", "The model system was not processed properly and then run!") }); return; } if (ValidateModelSystem()) { try { SetupRunDirectory(); if (!ValidateRuntimeModelSystem()) { // The call will already signal the errors. return; } _Root.Save(Path.Combine(RunDirectory, "RunParameters.xml")); ModelSystemStructureModelRoot = new ModelSystemStructureModel(null, _Root); MST.Start(); InvokeRunCompleted(); } catch (ThreadAbortException) { // This is fine just continue } catch (Exception e) { GetInnermostError(ref e); List <int> path = null; string moduleName = null; if (e is XTMFRuntimeException runtimeError) { if (runtimeError.Module != null) { path = GetModulePath(runtimeError.Module); moduleName = runtimeError.Module.Name; } else { path = null; moduleName = "Null Module"; } } InvokeRuntimeError(new ErrorWithPath(path, e.Message, e.StackTrace, moduleName, e)); } } }