question

UwePilgram-3067 avatar image
0 Votes"
UwePilgram-3067 asked ·

Deserializing an Object serialized with the Binary Formatter fails when using a different Executable

Hi all,
I have a solution in VS 2019 which contains 2 projects coded to produce 2 executables:

  • One has a class that serializes an object with some lists in it.

  • The other uses the same class to deserialize the binary stream generated by the above.

Compiling both cases in one project to one executable, this runs flawlessly.
Compiling identical classes separately into 2 different executables, deserialization crashes, because it searches for the executable used to serialize the stream.

Context: W10 latest, VS 2019 latest, .Net Framework 4.8, C#

Regards
Jörg

dotnet-runtime
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I digged a little deeper: it seems that with binary serialization the serialized object is by design bound to the file name (not the path) of the exe/dll used to serialized it.

Ciao
JD

0 Votes 0 ·

1 Answer

JerryCai-MSFT avatar image
0 Votes"
JerryCai-MSFT answered ·

Hi,UwePilgram

What is the error message?

You can check whether both exes have the required dlls

And when compiled into two exe files, check whether the calling path is correct.

Best Regards,
Jerry Cai


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.