public virtual void Dispose() { // Disposing the json writer closes the stream but the textwriter // still needs to be disposed or closed to write the results if (_issueLogJsonWriter != null) { _issueLogJsonWriter.CloseResults(); if (_run?.Invocations?.Count > 0 && _run.Invocations[0].StartTimeUtc != new DateTime()) { _run.Invocations[0].EndTimeUtc = DateTime.UtcNow; } _issueLogJsonWriter.CompleteRun(); _issueLogJsonWriter.Dispose(); } if (_textWriter != null) { _textWriter.Dispose(); } if (_jsonTextWriter == null) { _jsonTextWriter.Close(); } GC.SuppressFinalize(this); }
public virtual void Dispose() { // Disposing the json writer closes the stream but the textwriter // still needs to be disposed or closed to write the results if (_issueLogJsonWriter != null) { _issueLogJsonWriter.CloseResults(); if (_run?.Invocations?.Count > 0 && _run.Invocations[0].StartTimeUtc != new DateTime() && !_dataToRemove.HasFlag(OptionallyEmittedData.NondeterministicProperties)) { _run.Invocations[0].EndTimeUtc = DateTime.UtcNow; } _issueLogJsonWriter.CompleteRun(); _issueLogJsonWriter.Dispose(); } if (_closeWriterOnDispose) { if (_textWriter != null) { _textWriter.Dispose(); } if (_jsonTextWriter == null) { _jsonTextWriter.Close(); } } GC.SuppressFinalize(this); }
public void Dispose() { // Disposing the json writer closes the stream but the textwriter // still needs to be disposed or closed to write the results if (_issueLogJsonWriter != null) { _issueLogJsonWriter.CloseResults(); if (_run != null && _run.ConfigurationNotifications != null) { _issueLogJsonWriter.WriteConfigurationNotifications(_run.ConfigurationNotifications); } if (_run != null && _run.ToolNotifications != null) { _issueLogJsonWriter.WriteToolNotifications(_run.ToolNotifications); } if (_run != null && _run.Invocation != null && _run.Invocation.StartTime != new DateTime()) { _run.Invocation.EndTime = DateTime.UtcNow; } // Note: we write out the backing rules // to prevent the property accessor from populating // this data with an empty collection. if (_rules != null) { _issueLogJsonWriter.WriteRules(_rules); } if (_run != null && _run.Files != null) { _issueLogJsonWriter.WriteFiles(_run.Files); } if (_run != null && _run.Invocation != null) { _issueLogJsonWriter.WriteInvocation(invocation: _run.Invocation); } _issueLogJsonWriter.Dispose(); } if (_textWriter != null) { _textWriter.Dispose(); } if (_jsonTextWriter == null) { _jsonTextWriter.Close(); } GC.SuppressFinalize(this); }