I believe that I have found a bug in the serialization of ListDictionary when using FormatterAssemblyStyle.Simple. The error I am seeing is:
SerializationException: Parse Error, no assembly associated with Xml key a1:http://schemas.microsoft.com/clr/nsassem/System.Collections.Specialized/System ListDictionary Can someone give me a sanity check and/or suggest how to get MS to fix this? Demonstration code follows. -- Brian ----------------------------------------------- using System; using System.Collections; using System.Collections.Specialized; using System.Diagnostics; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Soap; using System.Text; class Bug { static object Bounce(object obj) { MemoryStream stream = new MemoryStream(); SoapFormatter serializer = new SoapFormatter(); serializer.AssemblyFormat = FormatterAssemblyStyle.Simple; serializer.Serialize(stream, obj); Console.WriteLine("Bouncing {0}...", obj); Console.WriteLine(new string(Encoding.ASCII.GetChars(stream.ToArray()))); stream.Seek(0, SeekOrigin.Begin); serializer = new SoapFormatter(); return serializer.Deserialize(stream); } static void Try(IDictionary dict) { dict["a"] = "john"; dict["b"] = "paul"; dict["c"] = "george"; dict["d"] = "ringo"; dict = (IDictionary) Bounce(dict); Debug.Assert((string) dict["a"] == "john"); Debug.Assert((string) dict["b"] == "paul"); Debug.Assert((string) dict["c"] == "george"); Debug.Assert((string) dict["d"] == "ringo"); } public static void Main() { Try(new Hashtable()); // this works Try(new ListDictionary()); // this doesn't! } } =================================== This list is hosted by DevelopMentor� http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com
