diff --git a/BHoM_UI/Caller/Run.cs b/BHoM_UI/Caller/Run.cs index 55e3ec7..ea35c6e 100644 --- a/BHoM_UI/Caller/Run.cs +++ b/BHoM_UI/Caller/Run.cs @@ -78,7 +78,9 @@ public virtual object Run(List inputs) { try { - return m_CompiledFunc(inputs.ToArray()); + var result = m_CompiledFunc(inputs.ToArray()); + ResetLogSuppression(); + return result; } catch (InvalidCastException e) { @@ -88,10 +90,15 @@ public virtual object Run(List inputs) // Try to update the generic method to fit the input types MethodInfo method = Engine.Base.Compute.MakeGenericFromInputs(originalMethod, inputs.Select(x => x?.GetType()).ToList()); m_CompiledFunc = method.ToFunc(); - return m_CompiledFunc(inputs.ToArray()); + var result = m_CompiledFunc(inputs.ToArray()); + ResetLogSuppression(); + return result; } else + { + ResetLogSuppression(); throw e; + } } } else if (InputParams.Count <= 0) @@ -306,6 +313,14 @@ protected virtual bool ShouldCalculateNewResult(List inputs, ref object return true; } + /*************************************/ + + protected void ResetLogSuppression() + { + BH.Engine.Base.Compute.StopSuppressRecordingEvents(); //Ensure suppression is reset in case the calling method forgot to do it + BH.Engine.Base.Compute.ThrowErrorsAsExceptions(false); //Reset throwing errors to whatever the user may have set it to prior to running this method + } + /*************************************/ /**** Private Fields ****/