0

I've created a class and added the attribute DataContract, made some Properties with DataMember-Attribute.

After I add the sixth DataMember the object won't serialize... by removing the attribute it works again...

I'm slightly puzzled and my research didn't give me a suitable explanation nor solution :(

[DataContract]
public class MyClass {

    [DataMember]
    public Guid ID { get; set; }

    [DataMember]
    public String Name_1 { get; set; }

    [DataMember]
    public String Name_2 { get; set; }

    [DataMember]
    public String Name_3 { get; set; }

    [DataMember]
    public String Name_4 { get; set; }

    [DataMember]
    public String Name_5 { get; set; }

}

Oops... it's .Net 4.0 and ASP.Net Dev'Server

s_mon
  • 13
  • 3
  • What is the error, precisely, that you get? And what is the data like, could it be considered 'large'? There is no strict limit imposed explicitly, but there may be as a consequence on any given composition and its values. – Grant Thomas Jan 28 '13 at 12:45
  • `System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.` If I serialize the data as plain string it works fine... the shown contract isn't the real one, but it sticks to the five datamembers. – s_mon Jan 28 '13 at 12:52
  • Just playing with the amount of data, and it looks like you're right... this could be the problem... – s_mon Jan 28 '13 at 12:59

1 Answers1

0

After fiddling around, I'm certain it's the amount of data.

I switched to Json.NET... now it works fine :)

s_mon
  • 13
  • 3