ExecuteXmlReaderAsync doesn't work as expected

Lost Hybrid

New Member
I'm trying to implement XML reading from MSSQL using new async methods in .NET 4.5.I have the following code\[code\]var xmlReader = await sqlCommand.ExecuteXmlReaderAsync();while (await xmlReader.ReadAsync()){ var doc = (MyDocument)xmlSerializer.Deserialize(xmlReader); await Process(doc);}\[/code\]and it fails with Set XmlReaderSettings.Async to true if you want to use Async Methods.. I have checked decompiled sources of ExecuteXmlReaderAsync and I can see that it uses one of this settings:\[code\]private static readonly XmlReaderSettings DefaultXmlReaderSettings = new XmlReaderSettings(){ ConformanceLevel = ConformanceLevel.Fragment};private static readonly XmlReaderSettings DefaultXmlReaderSettingsCloseInput = new XmlReaderSettings(){ ConformanceLevel = ConformanceLevel.Fragment, CloseInput = true};\[/code\]so it looks like ExecuteXmlReaderAsync is not implemented well.Please advice if you have any experience to use this method successfully.UPD: xmlReader.Settings.Async is readonly so it should be set when the object is created
 
Back
Top