My First Request For The Next .NET Version

5 commentsWritten on June 23rd, 2010 by
Categories: .NET bugs

Please, pretty please, make the Tuple class serializable… i just got this exception:

Type 'System.Tuple`2[System.Guid,System.Nullable`1[System.Guid]]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.

That’s all… now if you’ll excuse me, i gotta go include a useless DTO in my project.

  • http://blogs.thinktecture.com/cweyer Christian Weyer

    Hm – I am using Tuple in WCF all the time. What exactly are you doing? :)

  • http://davybrion.com Davy Brion

    huh, that’s weird… i’m trying to return a tuple with a Guid and a Guid? from a WCF service :)

  • Pingback: More On System.Tuple And Serialization/Deserialization | The Inquisitive Coder – Davy Brion's Blog

  • googly

    IIRC, it’s System.Guid that lacks the parameterless constructor. You have to call the static Guid.NewGuid() to generate a new Guid.

    • http://davybrion.com Davy Brion

      System.Guid serializes just fine. The problem was that the Tuple types in Silverlight aren’t serializable because Silverlight doesn’t support the Serializable attribute.