Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4079440
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:48:07+00:00 2026-05-20T17:48:07+00:00

I am trying to deserialize SomeClass with an older version of an application. I

  • 0

I am trying to deserialize “SomeClass” with an older version of an application. I get this below exception

System.Runtime.Serialization.SerializationException: The ObjectManager found an invalid number of fixups. This usually indicates a problem in the Formatter.

Deserialization throws exception when I serialize version 0.9 and try to deserialize using version 0.8. I thought the OptionalField attribute would do the trick, but it didn’t.

// Version 0.8
[Serializable()]
class Foo{
  Bar b;
} 

// Version 0.9
[Serializable()]
class Foo{
  Bar b;
  [OptionalField]
  Zoo z;
}

Given that I cannot change version 0.8, how should I add more state to Foo object such that previous versions can deserialize whatever they can?

Any pointer will be really appreciated.

Update 1
Bar and Zoo are other classes which are serializable and contains Hashtables and other serializable stuff. Everything is serializable in those classes.
Also, I don’t have any struts.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:48:08+00:00Added an answer on May 20, 2026 at 5:48 pm

    First, never NEVER use the CLR’s serialization functions for anything that resembles long-term storage. We make that mistake usually once, put objects in a blob database field and pat ourselves in the back thinking we’re clever. And then the CLR gets a patch or our assemblies change versions and you’re screwed. So don’t do it.

    If you still want to do it, the best way to manage the problem is to create your own SerializationBinder that looks something like this:

    public sealed class CustomBinder : SerializationBinder {
    
        public override Type BindToType(string assemblyName, string typeName) {
    
            Type typeToDeserialize = null;
    
            if (typeName.IndexOf("SomeType") != -1) {
                typeToDeserialize = typeof(Foo.Bar.Bax.NewType);
            }
            else if (typeName.IndexOf("SomeOtherType") != -1) {
                typeToDeserialize = typeof(Foo.Bar.Bax.SomeOtherNewType);
            }
            else {
                // ... etc
            }
    
            return typeToDeserialize;
        }
    }
    

    Set the Binder property of the formatter you’re using prior to deserializing so that it overrides the defaults.

    Note that I’m not offering a drop-in solution here, I’m recommending how to solve the problem. Once you’ve converted out of whatever you’re doing, investigate other serialization technologies like protobuf, or write your own. Either way you should never rely on the CLR for long-term serialization support.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to deserialize a stream but I always get this error End
I am trying to deserialize this xml: <?xml version=1.0 encoding=UTF-8?> <query xmlns:yahoo=http://www.yahooapis.com/v1/base.rng yahoo:count=10 yahoo:created=2012-02-20T19:07:02Z
I get the following error when trying to deserialize an object in C#. Exception
I'm trying to deserialize sample JSON at the end of this question with below.
Im trying to deserialize an XML file with XmlSerializer, however im getting this exception:
I'm trying to deserialize an xml structure that looks like this: <somecontainer> <key1>Value1</key1> <key1>Value2</key1>
I am trying to deserialize this JSON array into my android project. [{Name:Ban,Price:1},{Name:Banana,Price:1},{Name:chicken,Price:14},{Name:pizza,Price:16},{Name:slice,Price:1}] I
I'm trying to deserialize object derived from Exception class: [Serializable] public class Error :
I'm trying to deserialize an XML file like this (it's actually a maven POM
I'm trying to deserialize XML with two namespaces, like this <records xmlns=http://www.foo.com/xml/records/1.1> <record xmlns=http://www.foo.com/xml/record/1.1>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.