From: Joe on
Sorry about taking so long to get back.

Using a struct only sort of works. It does not make it easy for data binding
to a data grid.


""Jialiang Ge [MSFT]"" <jialge(a)online.microsoft.com> wrote in message
news:DMiCK$YCJHA.4896(a)TK2MSFTNGHUB02.phx.gbl...
> Hello Joe,
>
> The old client app expects to know the type of MyClass.
> I find that a possible workaround in this issue is to declare MyClass as a
> struct (value type), instead of a class:
>
> public struct MyClass
> {
> private string mystring;
> private CustomEnum myenum1;
> private CustomEnum2 myenum2;
> }
>
> In this way, the old apps continue working fine. Please have a try and let
> me know whether the workaround is helpful to you.
>
> Have a nice weekend!
>
> Regards,
> Jialiang Ge (jialge(a)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:
> msdnmg(a)microsoft.com.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> =================================================
>


From: Joe on
My solution was to re-write MyCollection class as MyCollection :
CollectionBase, IBindingList.

"Joe" <jbassking(a)noemail.noemail> wrote in message
news:u2cNbuGCJHA.3348(a)TK2MSFTNGP04.phx.gbl...
> I'm getting an error when deserializing my objects:
> "The ObjectManager found an invalid number of fixups. This usually
> indicates a problem in the Formatter."
>
> I added a new object to a class that gets serialized and put the
> OptionalField attribute on that object. When trying to deserialize my
> object in an older version of our application that doesn't have this new
> class I get the above error but that's only when items have been added to
> the class.
>
> The class looks like this:
> public class MyCollection : BindingList<MyClass>
> {
>
> }
>
> public class MyClass
> {
> private string mystring;
> private CustomEnum myenum1;
> private CustomEnum2 myenum2;
> }
>
> public class ClassThatGetsSerialized
> {
> string member1;
> int member2;
> ...
> ...
> [OptionalField]
> MyCollection mycollection;
>
> ....
> }
>
> The error only occurs if object ClassThatGetsSerialized is deserialized by
> an older version that doesn't have the definition for MyCollection and if
> the member of ClassThatGetsSerialized.mycollection has items in it. If
> there are no items then the error does not happen.
>
> We use the OptionalField attribute in many places and it always works
> fine.
>
> Any ideas?
>
> Thanks,
> Joe
>