473,769 Members | 7,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BinaryFormatter .Deserialize after signing of assembly fails

Hello,

I have a class which is beeing serialized/deserialized using the
BinaryFormatter class. That has been working with no problems until I signed
all my assemblies. Now I get a SerializationEx ception when I try to
Deserialize the class which has been serialized before the signing. So what
is best practice in my situation?

Do I have to convert all my saved classes or do I write a
SerializationBi nder to handle it runtime?

If I delete all my data and run fra scratch it works fine until I compile my
assembly. Then the assembly gets a new versioand it fails on the version.
Why do I get this error now, i did'nt get it before I signed the assembly?

Best regards

Henrik Skak Pedersen
Nov 16 '05 #1
2 2730
Henrik:

I am not positive, but your description sounds like to could be a security
permission thing (in the first case). Check to make sure that the code
deserializing the object has the appropriate permissions.

In the second case, remember that serialization is senstivie to versioning
(the version of the assembly also includes the signing information). Make
sure that your serialization code is taking the versions into account. If
you serialized version A.B.C.D, you need to deserialize at least A.B (C.D
can be different, if memory serves).

So, check the permissions. If there are OK, you have a version mismatch
problem.

Hope this helps,
John Puopolo

"Henrik Skak Pedersen" <no**********@n othing.com> wrote in message
news:O0******** ******@TK2MSFTN GP14.phx.gbl...
Hello,

I have a class which is beeing serialized/deserialized using the
BinaryFormatter class. That has been working with no problems until I signed all my assemblies. Now I get a SerializationEx ception when I try to
Deserialize the class which has been serialized before the signing. So what is best practice in my situation?

Do I have to convert all my saved classes or do I write a
SerializationBi nder to handle it runtime?

If I delete all my data and run fra scratch it works fine until I compile my assembly. Then the assembly gets a new versioand it fails on the version.
Why do I get this error now, i did'nt get it before I signed the assembly?

Best regards

Henrik Skak Pedersen

Nov 16 '05 #2
Hi John,

Thank you very much for you reply.

Do I have to create a SerializationBi nder to handle the versioning you are
descriping? Or can I set it up only to take A.B into account?

Do you have an example which maybe can help me?

Henrik

"John Puopolo" <jo**********@f astsearch.com.n ospam> wrote in message
news:eC******** ******@TK2MSFTN GP10.phx.gbl...
Henrik:

I am not positive, but your description sounds like to could be a security
permission thing (in the first case). Check to make sure that the code
deserializing the object has the appropriate permissions.

In the second case, remember that serialization is senstivie to versioning
(the version of the assembly also includes the signing information). Make
sure that your serialization code is taking the versions into account. If
you serialized version A.B.C.D, you need to deserialize at least A.B (C.D
can be different, if memory serves).

So, check the permissions. If there are OK, you have a version mismatch
problem.

Hope this helps,
John Puopolo

"Henrik Skak Pedersen" <no**********@n othing.com> wrote in message
news:O0******** ******@TK2MSFTN GP14.phx.gbl...
Hello,

I have a class which is beeing serialized/deserialized using the
BinaryFormatter class. That has been working with no problems until I

signed
all my assemblies. Now I get a SerializationEx ception when I try to
Deserialize the class which has been serialized before the signing. So

what
is best practice in my situation?

Do I have to convert all my saved classes or do I write a
SerializationBi nder to handle it runtime?

If I delete all my data and run fra scratch it works fine until I compile

my
assembly. Then the assembly gets a new versioand it fails on the version.
Why do I get this error now, i did'nt get it before I signed the
assembly?

Best regards

Henrik Skak Pedersen


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3831
by: aladdinm1 | last post by:
Hi All, I have an annoying trouble with binary serialization. I have a windows forms application which works like a server and keeps sending data to its clients. The data is serialized before being sent using BinaryFormatter and a serializable object. When using a windows forms application as a client, everything works just fine and deserialized data can be received intact. When the client application is is embedded in Internet Explorer (I...
0
1055
by: aladdinm1 | last post by:
Hi All, Reference to the problem I posted with subject "BinaryFormatter.Deserialize fails when used with .net ActiveX". I could successfully solve the problem by creating a class inherited from SerializationBinder and setting the Binder property of the BinaryFormatter to an instance of that class. The code used was just one line to return the type used to serialize data. I got this information by help of the following Url: ...
3
5481
by: Joshua Moore | last post by:
I have a webservice that serializes a ton of variables and other good stuff to a txt file using SoapFormatter (IFormatter), and when I try to deserialize it using the binary formatter, i get the following error: BinaryFormatter Version incompatibility. Expected Version 1.0. Received Version 1986938170.1886350437. I've read a lot about this error from several sources on the net, but can't
0
1771
by: Fred Heida | last post by:
Hi Al, i have a funny problem.. i you can call it funny.. what i have is 2 assemblies, the first one does nothing other then Application.Run(new MyForm())
0
2077
by: Fruber Malcome | last post by:
I'm getting a very weird exception and hoping someone may be able to help. I have an Office Add-In that lives in a .dll (for email reference ai.dll) ai.dll makes calls into the core part of the application implementation in another .dll (let's call that app.dll). app.dll makes a function call into another dll (let's call that one dep.dll). dep.dll has some code in it where it deserializes a memorystream using a binaryformatter.
19
6246
by: Sharon | last post by:
Hi, When I'm doing BinaryFormatter.Deserialize() over a TCP socket. When I'm closing the TcpListener by invoking the TcpListener.Stop(); I get: System.IO.IOException with message "Unable to read data from the transport connection." that InnerException of type System.Net.Sockets.SocketException saying "An established connection was aborted by the software in your host machine".
11
3122
by: JZ | last post by:
Hi, I'm using a class and binary formatter to store data in files. For example.. Dim FPs As New StuctureDataFile() Dim FileStream As Stream = File.Open(pfile, FileMode.Open) Dim FileFormatter As New BinaryFormatter() FPs = DirectCast(FileFormatter.Deserialize(FileStream), StuctureDataFile)
1
1757
by: Ryan.Mohammed | last post by:
I have a problem where the code that serializes and deserializes an object is actually not the start application but loaded by reflection and located in a subdirectory of the start application. Example \ Start.exe Platforms\Sub\Running.dll
2
1496
by: Lambuz | last post by:
Hi all, I'm triying to create a prototype of a smart client that using .NET Remoting. I've got an assembly loaded into an HTML page by a tag object <OBJECT id="myID" height="150" width="300" classid="http:bin/CPRSWebClient.dll#IBM.Cipros.Refinery.CPRSWebClient" /> My assembly is strong named and it is full trusted.
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9414
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10197
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9977
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9848
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7391
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3947
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.