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. Problems With BinaryFormatter

Problems With BinaryFormatter

Scheduled Pinned Locked Moved C#
comtoolshelpquestion
3 Posts 3 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.
  • R Offline
    R Offline
    Richard Blythe
    wrote on last edited by
    #1

    I'm using BinaryFormatter to serialize/deserialize some of my custom classes. On my development PC, everything is working fine but this morning, I installed the app on another PC and tried to load (deserialize) one the files. The object is deserialized with no errors but the string field: "ContactName" is null! Keep in mind that my development PC loads the file perfectly and I manually copied the same .exe and all Dlls from the dev PC to the other PC. Here's the code sample: // //Deserialization... // BinaryFormatter bf = new BinaryFormatter(); using (FileStream fs = File.Open(filePath, FileMode.Open)) { _SelectedTemplate = (LabelTemplate)bf.Deserialize(fs); } I'm I going crazy or do I send a nasty comment to Microsoft?

    If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.

    S A 2 Replies Last reply
    0
    • R Richard Blythe

      I'm using BinaryFormatter to serialize/deserialize some of my custom classes. On my development PC, everything is working fine but this morning, I installed the app on another PC and tried to load (deserialize) one the files. The object is deserialized with no errors but the string field: "ContactName" is null! Keep in mind that my development PC loads the file perfectly and I manually copied the same .exe and all Dlls from the dev PC to the other PC. Here's the code sample: // //Deserialization... // BinaryFormatter bf = new BinaryFormatter(); using (FileStream fs = File.Open(filePath, FileMode.Open)) { _SelectedTemplate = (LabelTemplate)bf.Deserialize(fs); } I'm I going crazy or do I send a nasty comment to Microsoft?

      If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #2

      Richard Blythe wrote:

      Keep in mind that my development PC loads the file perfectly and I manually copied the same .exe and all Dlls from the dev PC to the other PC.

      And what about the data file, is that the same on both PC? Keep in mind thousands of developer (including me!) used serialization without a hitch for a long while! ;)

      A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

      1 Reply Last reply
      0
      • R Richard Blythe

        I'm using BinaryFormatter to serialize/deserialize some of my custom classes. On my development PC, everything is working fine but this morning, I installed the app on another PC and tried to load (deserialize) one the files. The object is deserialized with no errors but the string field: "ContactName" is null! Keep in mind that my development PC loads the file perfectly and I manually copied the same .exe and all Dlls from the dev PC to the other PC. Here's the code sample: // //Deserialization... // BinaryFormatter bf = new BinaryFormatter(); using (FileStream fs = File.Open(filePath, FileMode.Open)) { _SelectedTemplate = (LabelTemplate)bf.Deserialize(fs); } I'm I going crazy or do I send a nasty comment to Microsoft?

        If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.

        A Offline
        A Offline
        Alan Balkany
        wrote on last edited by
        #3

        You're not going crazy; .NET serialization is full of bugs. Things don't work as advertised, and you have to come up with time-consuming workarounds. This is an example of what I call a "black-box failure", when a component you depend on, that you don't have the source code for malfunctions. It can be devastating, since you can't fix it. The standard approach to a black-box failure is to try to find a different way of doing the same thing. Another tactic is to upgrade to a later version of .NET, where the bug may have been fixed.

        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