Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: XmlMediaTypeFormatter reports that it can't serialize DataQuery with XmlSerializer [255]

$
0
0
If you set the default xmlmediatypeformatter to UseXmlSerializer, calls to CanWriteType with an instance of DataQuery<T> return false. This is usually triggered in a call to CreateResponse which then throws. DataQuery<T> is the concrete type that linq to sql implements IQueryable<T> with.

There's a branch in the implementation that seems to allow IQueryables for the datacontractserializer but only IEnumerables for the xml one.

If you subclass XmlMediaTypeFormatter and (for example) return true from CanWriteType, the underlying XmlSerializer writes the results back just fine.

Action methods that return IQueryable should be supported for both the data contract and xml serializers.
Comments: I was unable to repro. Linq to SQL seems to be working fine with XmlSerializer in an end-to-end scenario.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>