April 01, 2024

When you document something, try to make your documentation accurate

MS: When you document something, try to make your documentation accurate

After all, Microsoft is a multi-trillion $$$ global monopoly that apparently has enough $$$ to blow on the annual redrawing of icons and reshuffling the GUI.

If you are like me and going nuts because you are trying to serialize a collection of POCOs w/o those fucking namespaces being added to the collection element, and you are using DataContractSerializer and its supposedly but not-so-helpful attribute [CollectionDataContract(Namespace = "")] but still getting shit like

xmlns:i="http://www.w3.org/2001/XMLSchema-instance"

on your collection element, then do not try to find any wisdom in Microsoft's documentation: it's not there.

Documentation says that the attribute's Namespace property "Gets or sets the namespace for the data contract. That is not true. That is misleading and inaccurate. In reality it setts an ADDITIONAL namespace on top of the above piece of shit. You are SOL unless you massage the generated XML, which is lame.

That is why you may get the feeling that [CollectionDataContract(Namespace = "")] is being ignored. It is not! It works exactly like Microsoft's developers Hu and Wen designed it. It is just that Microsoft's technical writer Wei neglected to mention its true function. Or maybe they are developers Abishek and Kumar and the tech writer Rajendra. All the same shit.

Having written the above post, I went googling to see what other unfortunate souls tried, and I found this lament that does not have an answer to the day. The genius degenerate Frère Chloé suggested a custom serializer. She gets the Wasteful employee of the year award.

Someone commented how insane is the complexity of getting correct XML out of MS' classes. Yes: insane is as insane does. Wink, wink.

Posted by: LinuxLies at 09:09 AM | No Comments | Add Comment
Post contains 289 words, total size 2 kb.




What colour is a green orange?




15kb generated in CPU 0.0161, elapsed 0.0763 seconds.
35 queries taking 0.0667 seconds, 127 records returned.
Powered by Minx 1.1.6c-pink.