Questions tagged [binary-serialization]

The process of translating data structures or object state into a binary format

Serialization can be defined as the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.

http://en.wikipedia.org/wiki/Serialization
http://msdn.microsoft.com/en-us/library/72hyey7b(v=vs.110).aspx

178 questions
8
votes
2 answers

Should I Still Use BinaryFormatter for Simple Serialization in .NET 4.0?

I am developing a master-slave style application. The master application will send state data to the slave(s) to process and display at some constant rate. The state data is wrapped up into a single class that contains many fields. These field…
dewald
  • 5,133
  • 7
  • 38
  • 42
7
votes
2 answers

How much does a class/object have to change in order for binary-deserialization to fail

We have a solution where we are storing a fairly large/complex C# object in our database as binary data. My concern is that when changes are made to this class, we run the risk that data saved to the database will fail on deserialization after the…
Ben
  • 2,058
  • 9
  • 29
  • 39
6
votes
1 answer

Deserialize to type whose namespace has changed

Using .NET 4/C#... I need to deserialize old config files that contain the serialized representation of a type named, say, ns1.X . The serialization has been done using BinaryFormatter. The problem is, after a round of refactoring, the type X has…
Cristian Diaconescu
  • 34,633
  • 32
  • 143
  • 233
6
votes
4 answers

.NET Binary serialization metadata

A week ago I got in a situation where I had to read a binary serialized object made by another application made by somebody else. I only had the someSerializedData.bin file, so I tried to manually recreate the class definition for the unknown…
Dominik Antal
  • 3,281
  • 4
  • 34
  • 50
6
votes
5 answers

Binary deserialization without object definition

I'm trying to read a binary serialized object, I don't have the object definition/source for it. I took a peak into the file and saw property names, so I manually recreated the object (let's call it SomeDataFormat). I ended up with this : public…
Dominik Antal
  • 3,281
  • 4
  • 34
  • 50
5
votes
2 answers

Why does Get-Date seem to return DateTime objects, but the BinarySerializer indicate it returns a PSObject?

Take the simple HashTable: $data = @{ First = 'Justin'; Last = 'Dearing'; StartDate = Get-Date '2002-03-23'; } The key StartDate seems to contain a DateTime. C:\Users\zippy\Documents>…
Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
5
votes
2 answers

deserializing a generic list returns null

I'm de/serializing an object like so: public class myClass : ISerializable { public List value; public myClass(SerializationInfo info, StreamingContext context) { this.value = (List)info.GetValue("value",…
Steven Evers
  • 16,649
  • 19
  • 79
  • 126
5
votes
2 answers

Why classes not marked with Serializable cannot be serialized using BinaryFormatter?

As we all know and mentioned in MSDN site: The serialization architecture provided with the .NET Framework correctly handles object graphs and circular references automatically. The only requirement placed on object graphs is that all objects …
M. Jahedbozorgan
  • 6,914
  • 2
  • 46
  • 51
5
votes
2 answers

How to optimize class for viewstate

If I have an object I need to store in viewstate, what kinds of things can I do to optimize the size it takes to store the object? Obviously storing the least amount of data will take less space, but aside from that, are there ways to architect the…
Jeremy
  • 44,950
  • 68
  • 206
  • 332
5
votes
1 answer

How to write to file when using Marshal::dump in Ruby for object serialization

Lets say I have the object line from class Line: class Line def initialize point1, point2 @p1 = point1 @p2 = point2 end end line = Line.new... How can I binary serialize the line object? I tried with: data = Marshal::dump(line,…
user2128702
  • 2,059
  • 2
  • 29
  • 74
5
votes
2 answers

Read/Write a Nullable Type using BinaryReader?

I am overloading the System.IO BinaryReader to serialize some classes for file storage purposes. I have had no issues doing items like dictionaries and such, but have not been successful with a nullable type. Is it possible to do? Specifically I am…
RiddlerDev
  • 7,370
  • 5
  • 46
  • 62
4
votes
1 answer

Binary serialization of mutable F# record

I have used binary serialization to save an F# record from a C# class. All works fine: F#: type GameState = { LevelStatus : LevelStatus Grid : Variable [,]> ... } let game_state : GameState =…
Heisenbug
  • 38,762
  • 28
  • 132
  • 190
4
votes
1 answer

What NuGet package should I use between protobuf-net and google.protobuf for a new .net core app?

What NuGet package should I use between protobuf-net and google.protobuf for a new .net core app? It is for "Code first", not contract first. It is actually only for C# but would be great if more languages could easily read the format but not a…
Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119
4
votes
3 answers

Where is this non-serializable object?

I'm trying to serialize an object and the following SerializationException is thrown: Type 'System.Linq.Enumerable+d__71`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' in Assembly 'System.Core,…
Suraj
  • 35,905
  • 47
  • 139
  • 250
4
votes
1 answer

Compatibility of .NET Framework and Core BinaryFormatter

I'm wondering if an object serialized with the .NET Framework BinaryFormatter can be deserialized with the .NET Core BinaryFormatter and vice versa. To what extent are these formats compatible? Context: I'm porting parts of a legacy app to .NET Core…
Dejan
  • 9,150
  • 8
  • 69
  • 117
1
2
3
11 12