Skip to content

Commit

Permalink
Dipose XmlReaders in Microsoft.TestPlatform.Common.RunSettings (#5100)
Browse files Browse the repository at this point in the history
It probably makes no impact, but the XmlReaders are declared as
IDisposable, so we should Dispose() them when done using them.

Co-authored-by: Jakub Jareš <[email protected]>
  • Loading branch information
omajid and nohwnd authored Jul 10, 2024
1 parent 3a6c061 commit a98de4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.TestPlatform.Common/RunSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down

0 comments on commit a98de4e

Please sign in to comment.