diff --git a/src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs b/src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs index 8dfa960..2ac8862 100644 --- a/src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs +++ b/src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs @@ -32,7 +32,7 @@ public TraceSink(ITextFormatter textFormatter) public void Emit(LogEvent logEvent) { if (logEvent == null) throw new ArgumentNullException(nameof(logEvent)); - var sr = new StringWriter(); + using var sr = new StringWriter(); _textFormatter.Format(logEvent, sr); var text = sr.ToString().Trim();