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<MyC lass>
{
}
[Serializable]
public class MyClass
{
private string mystring = "test";
}
[Serializable()]
class ClassThatGetsSe rialized
{
public ClassThatGetsSe rialized()
{
mycollection.Ad d(new MyClass());
}
[OptionalField]
MyCollection mycollection = new MyCollection();
public void Save()
{
System.IO.FileS tream oStream = new
System.IO.FileS tream("c:\\test .txt",
System.IO.FileM ode.Create);
IFormatter oFormatter = (IFormatter)new BinaryFormatter ();
oFormatter.Seri alize(oStream, this);
oStream.Close() ;
}
}
ClassThatGetsSe rialized obj = new ClassThatGetsSe rialized();
obj.Save();
**** App that deserialize the object ****
[Serializable()]
class ClassThatGetsSe rialized
{
public static ClassThatGetsSe rialized LoadObject()
{
System.IO.FileS tream oStream = new
System.IO.FileS tream("c:\\test .txt",
System.IO.FileM ode.Open);
IFormatter oFormatter = (IFormatter)new BinaryFormatter ();
ClassThatGetsSe rialized obj =
(ClassThatGetsS erialized)oForm atter.Deseriali ze(oStream);
oStream.Close() ;
return obj;
}
}
ClassThatGetsSe rialized obj = ClassThatGetsSe rialized.LoadOb ject();
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.O bjectManager.Do Fixups()
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. Deserialize(Hea d
erHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomai n, IMethodCallMess age methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( S
tream serializationSt ream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomai n, IMethodCallMess age methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( S
tream serializationSt ream)
at ConsoleApplicat ion1.ClassThatG etsSerialized.L oadObject()
at ConsoleApplicat ion1.Program.Ma in(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****@microsof t.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
=============== =============== =============== ====