Hello Joe,
Thank you for reporting this issue to us. I've reproduced the symptom on my
side with your instructions:
**** App that serialize the object ****
[Serializable]
public class MyCollection : BindingList<MyClass>
{
}
[Serializable]
public class MyClass
{
private string mystring = "test";
}
[Serializable()]
class ClassThatGetsSerialized
{
public ClassThatGetsSerialized()
{
mycollection.Add(new MyClass());
}
[OptionalField]
MyCollection mycollection = new MyCollection();
public void Save()
{
System.IO.FileStream oStream = new
System.IO.FileStream("c:\\test.txt",
System.IO.FileMode.Create);
IFormatter oFormatter = (IFormatter)new BinaryFormatter();
oFormatter.Serialize(oStream, this);
oStream.Close();
}
}
ClassThatGetsSerialized obj = new ClassThatGetsSerialized();
obj.Save();
**** App that deserialize the object ****
[Serializable()]
class ClassThatGetsSerialized
{
public static ClassThatGetsSerialized LoadObject()
{
System.IO.FileStream oStream = new
System.IO.FileStream("c:\\test.txt",
System.IO.FileMode.Open);
IFormatter oFormatter = (IFormatter)new BinaryFormatter();
ClassThatGetsSerialized obj =
(ClassThatGetsSerialized)oFormatter.Deserialize(oS tream);
oStream.Close();
return obj;
}
}
ClassThatGetsSerialized obj = ClassThatGetsSerialized.LoadObject();
When I run the Deserialization app after running the Serialization one, I
get the exception "The ObjectManager found an invalid number of fixups.
This usually indicates a problem in the Formatter". The callstack is:
at System.Runtime.Serialization.ObjectManager.DoFixup s()
at
System.Runtime.Serialization.Formatters.Binary.Obj ectReader.Deserialize(Head
erHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(S
tream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(S
tream serializationStream)
at ConsoleApplication1.ClassThatGetsSerialized.LoadOb ject()
at ConsoleApplication1.Program.Main(String[] args)
Joe, I suggest your submitting this issue to our feedback site, where the
product group will further look into it:
http://connect.microsoft.com/VisualStudio
It's appreciated if you paste the feedback link here to benefit the
community.
Thanks
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================