Skip to content

Use ReadToEndAsync in LoadAsync polyfills#479

Merged
SimonCropp merged 5 commits intomainfrom
Use-ReadToEndAsync-in-LoadAsync-polyfills
Feb 25, 2026
Merged

Use ReadToEndAsync in LoadAsync polyfills#479
SimonCropp merged 5 commits intomainfrom
Use-ReadToEndAsync-in-LoadAsync-polyfills

Conversation

@SimonCropp
Copy link
Owner

Mark XDocument/XElement.LoadAsync as async and read the provided TextReader using ReadToEndAsync, then call XDocument.Load/XElement.Load on the resulting string. This replaces the previous Task.FromResult of the synchronous Load(textReader, ...) to avoid blocking on reader IO and enable asynchronous reading; cancellation is still checked at the start of the methods.

Mark XDocument/XElement.LoadAsync as async and read the provided TextReader using ReadToEndAsync, then call XDocument.Load/XElement.Load on the resulting string. This replaces the previous Task.FromResult of the synchronous Load(textReader, ...) to avoid blocking on reader IO and enable asynchronous reading; cancellation is still checked at the start of the methods.
@SimonCropp SimonCropp added this to the 9.12.0 milestone Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant