binaryformatter Questions

7

Before .NET5 we serialize/deserialize the Bytes/Object by these code: private static byte[] StructToBytes<T>(T t) { using (var ms = new MemoryStream()) { var bf = new BinaryFormatter();...
Higginbotham asked 12/11, 2020 at 7:29

2

Solved

I have a file in which I am writing the content using the below C# code. ConcurrentDictionary<string, DateTime> _jobsAck; public void SaveToDisk() { var binaryFormatter = new BinaryFormatter...
Villenage asked 22/8, 2023 at 12:16

5

I have migrated a couple of ASP.Net Core 2.2 projects to .Net 5, the last issue I have is that I get a System.NotSupported exception when trying to load bitmaps from the project resources. RtfUtili...
Sclerosed asked 1/11, 2021 at 12:1

6

Serializing/deserializing with BinaryFormatter, resulting serialized file is ~80MB in size. The deserialization takes a few minutes. How could I improve on this? Here's the deserialization code: ...
Institutive asked 25/10, 2009 at 11:25

3

Solved

I've heard there are safety questions over the BinaryFormatter. I send user-generated files to the server from the client. These are serialized classes that are then read by the server. From my ...
Bouse asked 8/1, 2014 at 8:46

5

I am working on a .NET Core project and I am trying to parse my List<T> to byte[]. Using the .NET Framework, we could have achieved the same by using BinaryFormatter, but at the time of writi...
Transgress asked 1/3, 2017 at 8:20

1

Solved

Microsoft warns against using BinaryFormatter (they write that there is no way to make the de-serialization safe). Applications should stop using BinaryFormatter as soon as possible, even if they ...
Landtag asked 26/3, 2021 at 22:23

4

Solved

I'm trying to make the BinaryFormatter work across different versions of my assembly. The actual class I want to deserialize to is exactly the same in each assembly version, but on deserialization,...
Enjoin asked 26/4, 2011 at 18:20

2

I am facing a very nasty problem that I cannot identify. I am running a very large business ASP.Net application containing many thousands of objects; It uses serialization/deserialization in memory...
Cheryllches asked 9/8, 2013 at 7:52

3

Solved

We use BinaryFormatter in a C# game, to save user game progress, game levels, etc. We are running into the problem of backwards compatibility. The aims: Level designer creates campaign (levels&a...
Carleycarli asked 27/8, 2010 at 11:29

2

Solved

I'm new to object serialization, and in the course of my learning how to read from and write to a file (deserialize and serialize) using BinaryFormatter, I came across BinaryReader and BinaryWriter...

1

Solved

I have old project which used ADO.NET to access the persistent store. Currently, I want to migrate it to EF (6.1.3, if it matters), in order to support several DB providers with minimal code duplic...
Abbate asked 15/9, 2016 at 6:18

3

I have a simple class that is marked as Serializable, and it happens to have an event. I tried to mark the event member as NonSerialized, however the compiler complains. Yet when I go to serialize ...
Sovran asked 22/2, 2010 at 3:26

2

Solved

One of the solutions in our company consumes a 3rd party service. Communication is done through XML messaging. On our end, we generate classes to be used based on XML schemas that they provide us, ...
Margarite asked 4/5, 2015 at 0:42

1

Solved

I was using BinaryFormatter to store my application settings. Now, several years into continued development, after many users are already using my application, I want to change how several cl...
Jaleesa asked 6/9, 2014 at 14:53

5

Solved

I am using BinaryFormatter to serialize an array of class instances to a file. I can deserialize this fine within the same application. When I try the same deserialization in a different applicatio...
Thorman asked 16/11, 2010 at 12:7

1

Solved

I'm currently writing a bidirectional map class, and I'm having some troubles with the serialization/deserialization of the class (question at bottom). Here's the parts of the class that's relevan...
Vest asked 30/8, 2014 at 13:25

6

Solved

I'm getting an: System.Runtime.Serialization.SerializationException: Unable to find assembly 'myNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null When trying to deserialize so...
Faker asked 22/1, 2010 at 19:53

1

Solved

I need to write huge arrays of longs (up to 5GB) to disk. I tried using BinaryFormatter but it seems to be able to write only arrays of size lower than 2GB: long[] array = data.ToArray(); FileStre...
Orlene asked 13/8, 2014 at 21:10

2

Solved

Suppose I had this class: [Serializable] public class SomeClass { public SomeClass() {//init} public string SomeString {get;set;} } This class gets Serialized when the application closes, and...
Mehalick asked 31/10, 2013 at 23:20

2

Solved

I have the following method to generate a hash of an object. It works pretty good! But when I change the version of the assembly, the hash is changing even when the object is the same. public stat...
Annecorinne asked 10/10, 2013 at 7:45

1

The book CLR Via C# presents a simple way to clone objects via binary serialization. It specifies StreamingContextStates.Clone when creating the BinaryFormatter like so: var formatter = new Binar...
Shekinah asked 17/6, 2013 at 20:24

2

Solved

I am working on a project where I need to upload image to my server. I want to store my image's binary data to BLOB data type field in database. Therefore I need to convert my image into binary for...
Alexander asked 6/5, 2013 at 10:30

1

Solved

After searching for an answer to this issue for the last 2 days, I'm hoping someone here can help. I have written a program in c# using VS2012 that saves the user's project data using BinaryFormat...
Bonny asked 9/4, 2013 at 16:54

1

Solved

I'm using RemotingServices.Marshal and Activator.GetObject to establish a remoting channel between two simple programs residing on the same computer. public class IpcInterface : MarshalByRefObject...
Affection asked 21/11, 2012 at 4:43

© 2022 - 2024 — McMap. All rights reserved.