Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Deserialize old versions

Deserialize old versions

Scheduled Pinned Locked Moved C#
announcement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eggsovereasy
    wrote on last edited by
    #1

    I have a program that I didn't write, but maintain. Recently the assembly version was incremented to 1.0.1.0 and when it tries to load serialized objects (binary formatter) that were made with 1.0.0.0 I get an InvalidCastException. There was nothing changed in these on the objects themselves so there should be really need to be a cast.

    M 1 Reply Last reply
    0
    • E eggsovereasy

      I have a program that I didn't write, but maintain. Recently the assembly version was incremented to 1.0.1.0 and when it tries to load serialized objects (binary formatter) that were made with 1.0.0.0 I get an InvalidCastException. There was nothing changed in these on the objects themselves so there should be really need to be a cast.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Maybe use a SerializationBinder[^]? Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      E 1 Reply Last reply
      0
      • M Mark Salsbery

        Maybe use a SerializationBinder[^]? Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        E Offline
        E Offline
        eggsovereasy
        wrote on last edited by
        #3

        Thanks for the reply. Because there was no actual change in the class (just version) I was able to just change the Version number listed in the binary file to the new version and it cast fine from there on out.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups