Problem with binary serialization.

Hi,

I have encountered a problem when I use BinaryFormatter with a property TypeFormat setted to FormatterTypeStyle.TypesWhenNeeded. It looks like when
it is used then attribute [OptionalField] does not work anymore so it is not
possible to load serialized objects of the previous versions even with the
new fields marked as OptionalField.

When TypeFormat = FormatterTypeStyle.TypesAlways was used then
everything is OK. I could not find any description of such strange behavior
neither in MSDN nor in Internet. Is it a normal situation with binary
serialization or a bug? Could you describe workaround solution if it exists please?

Thanks in advance.

[708 byte] By [AntonRau] at [2007-12-25]

.NET Development

Site Classified