Пример #1
0
 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();
         _issueLogJsonWriter.WriteRuleInfo(this.ruleDescriptors);
         _issueLogJsonWriter.Dispose();
     }
     if (_textWriter != null)
     {
         _textWriter.Dispose();
     }
 }
Пример #2
0
        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.StartTime != new DateTime())
                {
                    _run.EndTime = DateTime.UtcNow;
                }

                _issueLogJsonWriter.WriteRunProperties(
                    invocation: _run.Invocation,
                    startTime: _run.StartTime,
                    endTime: _run.EndTime,
                    correlationId: _run.CorrelationId,
                    architecture: _run.Architecture);

                if (_run.Files != null)
                {
                    _issueLogJsonWriter.WriteFiles(_run.Files);
                }

                // 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);
                }

                _issueLogJsonWriter.Dispose();
            }
            if (_textWriter != null)
            {
                _textWriter.Dispose();
            }
        }