-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlCommand.ExecuteXmlReaderAsync() returns an XmlReader object with Settings.Async = false #781
Comments
Hi @GMacAussie Thanks for bringing this to our attention. I've created PR #782 to fix this issue. |
The documentation for
|
Is this issue fixed? |
Describe the bug
The SqlCommand ExecuteXmlReaderAsync() method returns an XmlReader object. However, methods (such as MoveToContentAsync) against this XmlReader object raise:
Examining the XmlReader object, the Settings.Async flag is false which means that the Async methods cannot be used against it.
It appears that the XmlReader object was created by the ExecuteXmlReaderAsync() method with the Async setting as false (or default). This flag is read-only so this method must itself set the flag true.
Microsoft.Data.SqlClient 2.1.0-preview2.20297.7
System.Data.SqlClient 4.7.2
To reproduce
See attached solution that attempts to use ExecuteXmlReaderAsync() method against Microsoft.Data.SqlClient and System.Data.SqlClient libraries.
AsyncXmlReader.zip
Expected behavior
SqlCommand ExecuteXmlReaderAsync() method should return an XmlReader object that has XmlReaderSettings.Async set to true so that further Async methods against the XmlReader object work as expected.
Further technical details
Microsoft.Data.SqlClient version: 2.1.0-preview2.20297.7
.NET target: 4.7.2
SQL Server version: SQL Server 14.0.1000
Operating system: Windows 10 Pro Version 10.0.19041 Build 19041
Additional context
This was reported for System.Data.SqlClient but I was directed here and reproduced it for Microsoft.Data.SqlClient:
https://developercommunity2.visualstudio.com/t/sqlcommandexecutexmlreaderasync-returns-an-xmlread/926539
The text was updated successfully, but these errors were encountered: