diff --git a/src/Microsoft.TestPlatform.Common/RunSettings.cs b/src/Microsoft.TestPlatform.Common/RunSettings.cs index 5568afa46d..42eadcd8a4 100644 --- a/src/Microsoft.TestPlatform.Common/RunSettings.cs +++ b/src/Microsoft.TestPlatform.Common/RunSettings.cs @@ -80,7 +80,7 @@ public void LoadSettingsXml(string settings) } using var stringReader = new StringReader(settings); - var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); + using var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); ValidateAndSaveSettings(reader); } @@ -91,7 +91,7 @@ public void LoadSettingsXml(string settings) public void InitializeSettingsProviders(string settings) { using var stringReader = new StringReader(settings); - var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); + using var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); ReadRunSettings(reader); }