Serialization, Deserialization Problem in 4.1. NET 2.0

Hello, the following easy code worked in SF 3.3 and .NET 1.1 and throws an exception in 4.1. CellValueType isn''t stored correctly. If I change the produced xml from to System.String no exception is thrown. void SerializeDeserialize() { GridStyleInfo info = new GridStyleInfo(); info.CellValueType = typeof(string); info.Format = "G"; MemoryStream memStream = new MemoryStream(1000); XmlSerializer serializer = new XmlSerializer(info.Store.GetType()); serializer.Serialize(memStream, info.Store); System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("windows-1252"); string xml = encoder.GetString(memStream.GetBuffer()); memStream = new MemoryStream(encoder.GetBytes(xml)); GridStyleInfo info2 = (GridStyleInfo)serializer.Deserialize(memStream); } Any Ideas? Thanks, Uwe

2 Replies

UW Uwe Wittig December 16, 2005 04:15 PM UTC

Sorry, there are some errors in the previous post: The last line should read: GridStyleInfoStore info2 = (GridStyleInfoStore)serializer.Deserialize(memStream); The XML won''t post correctly, so I try it in text: The CellValueType is empty but should have System.String as content. Thanks, Uwe


UW Uwe Wittig December 19, 2005 07:58 AM UTC

Hello, I posted this twice (one time in the Grid Forum)because the site gave me an error. The post in the Grid forum was answered satisfactorily. Thanks, Uwe

Loader.
Up arrow icon