wcf - DataContract Serialization gives "Index was outside the bounds of the array" exception ..C# -


i tried serialize large tree data structure in c# using datacontract serializer. got cyclic reference exception. marked [datacontract(isreference = true)] instead of [datacontract] against classes wherever required. "index outside bounds of array" exception. code follows:

    public void serialize(object obj, string file, type t)     {          using (filestream stream1 = new filestream(file, filemode.create))         {             stream1.position = 0;             datacontractserializer s = new datacontractserializer(t);              s.writeobject(stream1, obj);         }       } 

the above code works other serializations . in case of serializing tree object, not work. have marked [datacontract(isreference = true)] against required classes , [datamember] against required attributes.please help

i want suggest mark inherited classes datacontract(isreference = true) attribute. said done this. so, check again marks, , ensure of inherited classes marked. if inherited classes marked still error, check project wcf tracing.

tracing show happens during serialization process details.

you can find more details on msdn.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -