diff --git a/src/RulesEngine/Actions/ActionContext.cs b/src/RulesEngine/Actions/ActionContext.cs index af66cdc8..1c86778d 100644 --- a/src/RulesEngine/Actions/ActionContext.cs +++ b/src/RulesEngine/Actions/ActionContext.cs @@ -45,6 +45,13 @@ public bool TryGetContext(string name,out T output) { try { + //key not found return + //Returning a KeyNotFoundException has a significant impact on performance. + if (!_context.ContainsKey(name)) + { + output = default(T); + return false; + } output = GetContext(name); return true; }