From 72bee394bf461e8f6f0feb593a8416c05f481957 Mon Sep 17 00:00:00 2001 From: Gaizka Navarro Date: Thu, 14 Jul 2016 12:12:23 +0200 Subject: [PATCH] Updates ModelEvaluator for increase robustness against exceptions during model evaluation. --- .../Evaluation/CSEvalClient/ModelEvaluator.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Examples/Evaluation/CSEvalClient/ModelEvaluator.cs b/Examples/Evaluation/CSEvalClient/ModelEvaluator.cs index f753d8fbd638..a0e16d816315 100644 --- a/Examples/Evaluation/CSEvalClient/ModelEvaluator.cs +++ b/Examples/Evaluation/CSEvalClient/ModelEvaluator.cs @@ -110,9 +110,15 @@ public static void DisposeAll() public static bool Evaluate(string record) { var model = Models.Take(); - var outcome = model.EvaluateRecord(record); - Models.Add(model); - return outcome; + try + { + var outcome = model.EvaluateRecord(record); + return outcome; + } + finally + { + Models.Add(model); + } } /// @@ -123,9 +129,15 @@ public static bool Evaluate(string record) public static List Evaluate(List inputs) { var model = Models.Take(); - var outcome = model.EvaluateInput(inputs); - Models.Add(model); - return outcome; + try + { + var outcome = model.EvaluateInput(inputs); + return outcome; + } + finally + { + Models.Add(model); + } } ///