Skip to content

Commit

Permalink
Merge pull request #1332 from sillsdev/ensure-dispose-of-stream-in-mi…
Browse files Browse the repository at this point in the history
…gration

Added using to ensure that the XSL stream gets disposed in DoOneMigrationStep
  • Loading branch information
tombogle authored Aug 1, 2024
2 parents 4cceb9a + 6e99a66 commit e8ce8b2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions SIL.Lift/Migration/Migrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ public static string MigrateToLatestVersion(string pathToOriginalLift)

private static void DoOneMigrationStep(string xslName, string migrationSourcePath, string migrationTargetPath)
{
Stream xslstream = Assembly.GetExecutingAssembly().GetManifestResourceStream(xslName);
if (xslstream != null)
using (var xslstream =
Assembly.GetExecutingAssembly().GetManifestResourceStream(xslName))
{
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(new XmlTextReader(xslstream));
xsl.Transform(migrationSourcePath, migrationTargetPath);
if (xslstream != null)
{
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(new XmlTextReader(xslstream));
xsl.Transform(migrationSourcePath, migrationTargetPath);
}
}
}

Expand Down

0 comments on commit e8ce8b2

Please sign in to comment.