private static void StoreExceptionInContext(SpecFlowContext context, Exception x, string key) { if (!context.TryGetValue(key, out List <Exception> elist)) { elist = new List <Exception>(); context.Add(key, elist); } elist.Add(x); }