public void CsvToolsStackTraceTest() { var ex = new ApplicationException(); Assert.IsNull(ex.CsvToolsStackTrace()); try { throw ex; } catch (Exception e) { // ReSharper disable once PossibleNullReferenceException Assert.IsTrue(e.CsvToolsStackTrace().Contains("ExtensionsTest.CsvToolsStackTraceTest"), $"Expected: 'ExtensionsTest.CsvToolsStackTraceTest' Value: '{e.CsvToolsStackTrace()}'"); } try { Task.Run(Routine).RunSynchronously(); } catch (Exception e) { // ReSharper disable once PossibleNullReferenceException Assert.IsTrue(e.CsvToolsStackTrace().Contains("ExtensionsTest.CsvToolsStackTraceTest"), $"Expected: 'ExtensionsTest.CsvToolsStackTraceTest' Value: '{e.CsvToolsStackTrace()}'"); } }