Skip to content

Commit 07ece44

Browse files
JeffreySuCopilot
andauthored
Update src/Senparc.CO2NET/Utilities/XmlUtility/XmlUtility.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 22e8016 commit 07ece44

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Senparc.CO2NET/Utilities/XmlUtility/XmlUtility.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,10 @@ public static async Task<XDocument> ConvertAsync(Stream stream, CancellationToke
243243
{
244244
stream.Seek(0, SeekOrigin.Begin);//Force adjust pointer position
245245
}
246-
return await Task.Run(async () =>
246+
using (XmlReader xr = XmlReader.Create(stream, settings: new XmlReaderSettings() { CloseInput = closeInput, Async = true }))
247247
{
248-
using (XmlReader xr = XmlReader.Create(stream, settings: new XmlReaderSettings() { CloseInput = closeInput, Async = true }))
249-
{
250-
return await XDocument.LoadAsync(xr, LoadOptions.None, cancellationToken);
251-
}
252-
});
248+
return await XDocument.LoadAsync(xr, LoadOptions.None, cancellationToken);
249+
}
253250
}
254251
#endif
255252
#endregion

0 commit comments

Comments
 (0)