From ba255da522a04e5396b607464d404f81c8c3ca24 Mon Sep 17 00:00:00 2001 From: Virgile Bello Date: Wed, 10 Jul 2013 11:47:27 +0900 Subject: [PATCH] Assert: Check if TextExecutionContext.CurrentContext is valid. --- src/framework/Assert.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/framework/Assert.cs b/src/framework/Assert.cs index 9f35e72..cedf39a 100644 --- a/src/framework/Assert.cs +++ b/src/framework/Assert.cs @@ -1915,7 +1915,9 @@ namespace NUnit.Framework private static void IncrementAssertCount() { - TestExecutionContext.CurrentContext.IncrementAssertCount(); + var currentContext = TestExecutionContext.CurrentContext; + if (currentContext != null) + currentContext.IncrementAssertCount(); } #endregion