We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

strange serialization problem in 4.1. Beta with .NET 2.0

Hello, serialization and the following deserialization of GridStyleInfoStore Type gives me an error. The code worked in Syncfusion 3.3 and .NET 1.1 private string SerializeObject(ISerializable objectToSerialize) { MemoryStream memStream = new MemoryStream(1000); XmlSerializer ser2 = new XmlSerializer(objectToSerialize.GetType()); ser2.Serialize(memStream, objectToSerialize); System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("windows-1252"); return encoder.GetString(memStream.GetBuffer()); } private void DeserializeObjectFromString(Type typeToDeserialize, ref ISerializable objectToDeserialize, string data) { try { System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("windows-1252"); MemoryStream memStream = new MemoryStream(encoder.GetBytes(data)); XmlSerializer serializer = new XmlSerializer(typeToDeserialize); objectToDeserialize = (ISerializable)serializer.Deserialize(memStream); } catch (Exception ex) { textBox2.Text = ex.ToString(); } } GridStyleInfo info = new GridStyleInfo(); info.CellValueType = typeof(string); info.Format = "G"; textBox1.Text = SerializeObject(info.Store); textBox2.Text = ""; try { ISerializable store = null; DeserializeObjectFromString(typeof(Syncfusion.Windows.Forms.Grid.GridStyleInfoStore), ref store, textBox1.Text); } catch (Exception ex) { textBox2.Text = ex.ToString(); } The XML is: "G" It has to do with CellValueType, if I remove it there is no problem, also if I change it to there is no error. Thanks, Uwe

DeserializeObject0.zip

1 Reply

AD Administrator Syncfusion Team December 17, 2005 12:56 AM UTC

Hello Uwe, thanks for reporting this. It will be fixed in the final realease. The CellValueType was simply not written out to the xml. Thanks, Stefan >Hello, > >serialization and the following deserialization of GridStyleInfoStore Type gives me an error. The code worked in Syncfusion 3.3 and .NET 1.1 > > private string SerializeObject(ISerializable objectToSerialize) > { > MemoryStream memStream = new MemoryStream(1000); > XmlSerializer ser2 = new XmlSerializer(objectToSerialize.GetType()); > ser2.Serialize(memStream, objectToSerialize); > > System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("windows-1252"); > return encoder.GetString(memStream.GetBuffer()); > } > > private void DeserializeObjectFromString(Type typeToDeserialize, ref ISerializable objectToDeserialize, string data) > { > try > { > System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("windows-1252"); > MemoryStream memStream = new MemoryStream(encoder.GetBytes(data)); > > > XmlSerializer serializer = new XmlSerializer(typeToDeserialize); > objectToDeserialize = (ISerializable)serializer.Deserialize(memStream); > } > catch (Exception ex) > { > textBox2.Text = ex.ToString(); > } > } > > GridStyleInfo info = new GridStyleInfo(); > info.CellValueType = typeof(string); > info.Format = "G"; > > textBox1.Text = SerializeObject(info.Store); > > textBox2.Text = ""; > try > { > ISerializable store = null; > DeserializeObjectFromString(typeof(Syncfusion.Windows.Forms.Grid.GridStyleInfoStore), ref store, textBox1.Text); > } > catch (Exception ex) > { > textBox2.Text = ex.ToString(); > } > >The XML is: > > > > "G" > > >It has to do with CellValueType, if I remove it there is no problem, also if I change it to > there is no error. > >Thanks, >Uwe > > >

DeserializeObject0.zip

Loader.
Live Chat Icon For mobile
Up arrow icon