From e12f577bc8f1688985c2a2d01ce6c699407055d3 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 8 Jul 2024 03:57:12 -0400 Subject: [PATCH] Dispose IDisosables in HtmlTransformer (#5099) There's two IDisposables being used in HtmlTransformer. We should Dispose() both of them. --- .../HtmlTransformer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs index 7fe340f3b2..af5313cf1b 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -20,7 +20,8 @@ internal class HtmlTransformer : IHtmlTransformer public HtmlTransformer() { _xslTransform = new XslCompiledTransform(); - _xslTransform.Load(XmlReader.Create(GetType().Assembly.GetManifestResourceStream("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Html.xslt") ?? throw new InvalidOperationException(), new XmlReaderSettings { CheckCharacters = false })); + using var reader = XmlReader.Create(GetType().Assembly.GetManifestResourceStream("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Html.xslt") ?? throw new InvalidOperationException(), new XmlReaderSettings { CheckCharacters = false, CloseInput = true }); + _xslTransform.Load(reader); } ///