Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 303f204

Browse files
krwqdanmoseley
authored andcommitted
Close file in XmlSchemaSet tests in attempt to fix intermittent test failure (#27825)
* close file in XmlSchemaSet tests in attempt to fix intermittent test failure * fix compilation problem
1 parent 59f6987 commit 303f204

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Reprocess.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -635,15 +635,15 @@ public XmlSchema LoadSchema(string path, string baseuri)
635635
string correctUri = Path.GetFullPath(path);
636636
_output.WriteLine("Include uri: " + includeUri);
637637
_output.WriteLine("Correct uri: " + correctUri);
638-
Stream s = new FileStream(Path.GetFullPath(path), FileMode.Open, FileAccess.Read, FileShare.Read, 1);
639-
XmlReader r = XmlReader.Create(s, new XmlReaderSettings(), includeUri);
640-
_output.WriteLine("Reader uri: " + r.BaseURI);
641-
XmlSchema som = null;
642-
using (r)
638+
using (Stream s = new FileStream(Path.GetFullPath(path), FileMode.Open, FileAccess.Read, FileShare.Read, 1))
643639
{
644-
som = XmlSchema.Read(r, new ValidationEventHandler(ValidationCallback));
640+
XmlReader r = XmlReader.Create(s, new XmlReaderSettings(), includeUri);
641+
_output.WriteLine("Reader uri: " + r.BaseURI);
642+
using (r)
643+
{
644+
return XmlSchema.Read(r, new ValidationEventHandler(ValidationCallback));
645+
}
645646
}
646-
return som;
647647
}
648648
}
649649
}

0 commit comments

Comments
 (0)