473,769 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialization between different versions of the framework

When i store rule on PC with .NET.SP1 i cant restore them from PC without
SP1.
An i get this Error:

System.Runtime. Serialization.S erializationExc eption:
Possible Version mismatch. Type System.Collecti ons.Comparer has 1 members,
number of members deserialized is 0.

at
System.Runtime. Serialization.F ormatters.Binar y.ReadObjectInf o.GetMemberType s(String[]
inMemberNames)
at System.Runtime. Serialization.F ormatters.Binar y.ObjectMap..ct or(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA , Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at System.Runtime. Serialization.F ormatters.Binar y.ObjectMap.Cre ate(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA , Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yObjectWithMapT yped
record)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yHeaderEnum
binaryHeaderEnu m)
at System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.Run()
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. Deserialize(Hea derHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMess age
methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler, Boolean fCheck,
IMethodCallMess age methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream)
at OptOutManager.R ules.Get(Int32 idx) in D:\Projects\Rul es\Rules.cs:lin e
33

Whether it is possible to bypass it somehow

[Serializable]
public class Rule: ISerializable{
public bool Checked;
public string Name;
public Conditions conditions;
public Actions actions;
public string Description;
// Some methods declarations
}

[Serializable]
public class Conditions: ArrayList {
public ConditionsOpera torEnum Operator = ConditionsOpera torEnum.Or;

new public Condition this[int index]{
get {return (Condition)base[index];}
set {base[index] = value;}
}
// Some methods declarations
}

[Serializable]
public class Condition: ISerializable {
public bool Checked;
public string field;
public string word;
public ConditionType Type;
public bool MatchCase;
// Some methods declarations
}

[Serializable]
public class Action {
public bool Checked;
public ToDo todo;
public ComposeEmail sendEmail;
public Script script;
public DatabaseAction dbAction;
public ListsSubUnsub listsSubUnsub;
// Some methods declarations
}

[Serializable]
public class Actions: ArrayList {
public new Action this[int index]{
get {return (Action)base[index];}
set {base[index] = value;}
}
}

Nov 16 '05 #1
3 2458
Alexander,

This isn't necessarily related to different versions of the framework as
much as it is related to differences between the class type you are trying
to deserialize into. The metadata definition has changed, and isn't in sync
with what was found in the stream you are trying to deserialize from. Since
this is a framework type, you have little choice but to use serialized
versions of that type.

However, if it was your own type, you could implement custom
serialization, and perform a check to see what is available in the
SerializationIn fo class. If the values you need are not there, then you can
set to default values.

The serialization model in .NET 2.0 will include an OptionalField
attribute which when set on a field, will not cause an error if the
information does not exist in the serialized stream. This is to stem errors
from versioning, of course.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Alexander" <za*****@lencom .com> wrote in message
news:ey******** ******@TK2MSFTN GP11.phx.gbl...
When i store rule on PC with .NET.SP1 i cant restore them from PC without
SP1.
An i get this Error:

System.Runtime. Serialization.S erializationExc eption:
Possible Version mismatch. Type System.Collecti ons.Comparer has 1 members,
number of members deserialized is 0.

at
System.Runtime. Serialization.F ormatters.Binar y.ReadObjectInf o.GetMemberType s(String[]
inMemberNames)
at System.Runtime. Serialization.F ormatters.Binar y.ObjectMap..ct or(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA ,
Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectMap.Cre ate(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA , Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yObjectWithMapT yped
record)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yHeaderEnum
binaryHeaderEnu m)
at System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.Run()
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. Deserialize(Hea derHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMess age
methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler, Boolean fCheck,
IMethodCallMess age methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream)
at OptOutManager.R ules.Get(Int32 idx) in D:\Projects\Rul es\Rules.cs:lin e
33

Whether it is possible to bypass it somehow

[Serializable]
public class Rule: ISerializable{
public bool Checked;
public string Name;
public Conditions conditions;
public Actions actions;
public string Description;
// Some methods declarations
}

[Serializable]
public class Conditions: ArrayList {
public ConditionsOpera torEnum Operator = ConditionsOpera torEnum.Or;

new public Condition this[int index]{
get {return (Condition)base[index];}
set {base[index] = value;}
}
// Some methods declarations
}

[Serializable]
public class Condition: ISerializable {
public bool Checked;
public string field;
public string word;
public ConditionType Type;
public bool MatchCase;
// Some methods declarations
}

[Serializable]
public class Action {
public bool Checked;
public ToDo todo;
public ComposeEmail sendEmail;
public Script script;
public DatabaseAction dbAction;
public ListsSubUnsub listsSubUnsub;
// Some methods declarations
}

[Serializable]
public class Actions: ArrayList {
public new Action this[int index]{
get {return (Action)base[index];}
set {base[index] = value;}
}
}

Nov 16 '05 #2
Yes, but error in "System.Collect ions.Comparer" wich contains in
ArrayList(Condi tions and Actions inherit it), how can i control
serialization of ArrayList?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Alexander,

This isn't necessarily related to different versions of the framework
as much as it is related to differences between the class type you are
trying to deserialize into. The metadata definition has changed, and
isn't in sync with what was found in the stream you are trying to
deserialize from. Since this is a framework type, you have little choice
but to use serialized versions of that type.

However, if it was your own type, you could implement custom
serialization, and perform a check to see what is available in the
SerializationIn fo class. If the values you need are not there, then you
can set to default values.

The serialization model in .NET 2.0 will include an OptionalField
attribute which when set on a field, will not cause an error if the
information does not exist in the serialized stream. This is to stem
errors from versioning, of course.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Alexander" <za*****@lencom .com> wrote in message
news:ey******** ******@TK2MSFTN GP11.phx.gbl...
When i store rule on PC with .NET.SP1 i cant restore them from PC without
SP1.
An i get this Error:

System.Runtime. Serialization.S erializationExc eption:
Possible Version mismatch. Type System.Collecti ons.Comparer has 1
members,
number of members deserialized is 0.

at
System.Runtime. Serialization.F ormatters.Binar y.ReadObjectInf o.GetMemberType s(String[]
inMemberNames)
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectMap..ct or(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA ,
Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectMap.Cre ate(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA , Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yObjectWithMapT yped
record)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yHeaderEnum
binaryHeaderEnu m)
at System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.Run()
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. Deserialize(Hea derHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMess age
methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler, Boolean fCheck,
IMethodCallMess age methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream)
at OptOutManager.R ules.Get(Int32 idx) in
D:\Projects\Rul es\Rules.cs:lin e
33

Whether it is possible to bypass it somehow

[Serializable]
public class Rule: ISerializable{
public bool Checked;
public string Name;
public Conditions conditions;
public Actions actions;
public string Description;
// Some methods declarations
}

[Serializable]
public class Conditions: ArrayList {
public ConditionsOpera torEnum Operator = ConditionsOpera torEnum.Or;

new public Condition this[int index]{
get {return (Condition)base[index];}
set {base[index] = value;}
}
// Some methods declarations
}

[Serializable]
public class Condition: ISerializable {
public bool Checked;
public string field;
public string word;
public ConditionType Type;
public bool MatchCase;
// Some methods declarations
}

[Serializable]
public class Action {
public bool Checked;
public ToDo todo;
public ComposeEmail sendEmail;
public Script script;
public DatabaseAction dbAction;
public ListsSubUnsub listsSubUnsub;
// Some methods declarations
}

[Serializable]
public class Actions: ArrayList {
public new Action this[int index]{
get {return (Action)base[index];}
set {base[index] = value;}
}
}


Nov 16 '05 #3
Alexander,

That's the thing, you can not. If you need to control this, you might
have to use a different class (Comparer is an implementation of IComparer,
right? Use a different implementation that you control) altogether.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Alexander" <za*****@lencom .com> wrote in message
news:up******** ******@TK2MSFTN GP10.phx.gbl...
Yes, but error in "System.Collect ions.Comparer" wich contains in
ArrayList(Condi tions and Actions inherit it), how can i control
serialization of ArrayList?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Alexander,

This isn't necessarily related to different versions of the framework
as much as it is related to differences between the class type you are
trying to deserialize into. The metadata definition has changed, and
isn't in sync with what was found in the stream you are trying to
deserialize from. Since this is a framework type, you have little choice
but to use serialized versions of that type.

However, if it was your own type, you could implement custom
serialization, and perform a check to see what is available in the
SerializationIn fo class. If the values you need are not there, then you
can set to default values.

The serialization model in .NET 2.0 will include an OptionalField
attribute which when set on a field, will not cause an error if the
information does not exist in the serialized stream. This is to stem
errors from versioning, of course.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Alexander" <za*****@lencom .com> wrote in message
news:ey******** ******@TK2MSFTN GP11.phx.gbl...
When i store rule on PC with .NET.SP1 i cant restore them from PC
without
SP1.
An i get this Error:

System.Runtime. Serialization.S erializationExc eption:
Possible Version mismatch. Type System.Collecti ons.Comparer has 1
members,
number of members deserialized is 0.

at
System.Runtime. Serialization.F ormatters.Binar y.ReadObjectInf o.GetMemberType s(String[]
inMemberNames)
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectMap..ct or(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA ,
Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectMap.Cre ate(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA , Object[]
typeInformation A, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyI nfo assemblyInfo, SizedArray
assemIdToAssemb lyTable)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yObjectWithMapT yped
record)
at
System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.ReadObjectWit hMapTyped(Binar yHeaderEnum
binaryHeaderEnu m)
at System.Runtime. Serialization.F ormatters.Binar y.__BinaryParse r.Run()
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. Deserialize(Hea derHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMess age
methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler, Boolean fCheck,
IMethodCallMess age methodCallMessa ge)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream, HeaderHandler handler)
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deserialize( Stream
serializationSt ream)
at OptOutManager.R ules.Get(Int32 idx) in
D:\Projects\Rul es\Rules.cs:lin e
33

Whether it is possible to bypass it somehow

[Serializable]
public class Rule: ISerializable{
public bool Checked;
public string Name;
public Conditions conditions;
public Actions actions;
public string Description;
// Some methods declarations
}

[Serializable]
public class Conditions: ArrayList {
public ConditionsOpera torEnum Operator = ConditionsOpera torEnum.Or;

new public Condition this[int index]{
get {return (Condition)base[index];}
set {base[index] = value;}
}
// Some methods declarations
}

[Serializable]
public class Condition: ISerializable {
public bool Checked;
public string field;
public string word;
public ConditionType Type;
public bool MatchCase;
// Some methods declarations
}

[Serializable]
public class Action {
public bool Checked;
public ToDo todo;
public ComposeEmail sendEmail;
public Script script;
public DatabaseAction dbAction;
public ListsSubUnsub listsSubUnsub;
// Some methods declarations
}

[Serializable]
public class Actions: ArrayList {
public new Action this[int index]{
get {return (Action)base[index];}
set {base[index] = value;}
}
}



Nov 16 '05 #4

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

Similar topics

37
5021
by: Ben | last post by:
Hi, there. Recently I was working on a problem where we want to save generic closures in a data structure (a vector). The closure should work for any data type and any method with pre-defined signature. When developing this lib, I figured that the pointer-to-member-function, although seemingly an attractive solution, does not work well for us.
0
1620
by: HakonB | last post by:
Hi all I get an exception when trying to deserialize a simple configuration file using XML Serialization. The very long stacktrace can be seen at the bottom of this message. I've see other messages related a similar error but none of the solutions suggested are valid in case :/ I have tracked the problem down to the compilation of the temporary DLL that handles the actual serialization. The following commandline (that is one single...
4
3317
by: Alexander | last post by:
There was such problem, At compilation with SP1 (dotnetfx11SP1) On computers without him{it} ÎÅÄÅÓÅÒÉÁÌÉÚÕÀÔÓÑ some objects. For example (System. Collections. Comparer) and together with it{him} and all objects in which it{he} is used, for example ArrayList Whether it is possible to bypass it somehow
3
2876
by: Steve | last post by:
I've been following a couple remoting tutorials on the web, they are all pretty much the same. I've got my different applications built(client, server and remote object (dll)) The client is able to get a reference to the remote object and that works fine. When I try to make a call to a remote object's method I get an exception: System.Runtime.Serialization.SerializationException: Cannot find the assembly ProcessTest,...
4
7486
by: Brian Keating | last post by:
wonder if anyone can help me here, i've a framework 1.1 dataset which i serialize in framework 1.1 and deserialize in framework 2.0. This is fine, problem is that i want to modify some of the records in framework 2.0 and serialize the data so framework 1.1 can deserialize it and do what it required. Is this possible?
2
2540
by: Luck | last post by:
Hi, I really need some expert help... please! Basically, I need to serialize a data structure object to a file using SOAP and then load and de-serialize that file in ANOTHER program. When I serialize / deserialize the object in the SAME application, it works fine but when I simply copy the identical code to another application and try deserialization from that second application, I get the error: An unhandled exception of type...
1
2457
by: Tim Anderson | last post by:
I have an app that uses the SOAP serializer to serialize and deserialize a object of a certain class to a file. The class implements ISerializable. From time to time it is necessary to add or remove fields from the class. I've been able to deserialize out-of-date versions by handling serialization exceptions in Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext). I've now hit a problem. With the latest version, if...
5
6030
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the assembly 3- I am trying to deserialize from an EXE that references version 2.0 of the assembly 4- Both version 1.0 and 2.0 of the assembly reside in the GAC (no policy redirects exist).
3
2643
by: Zachary Turner | last post by:
Hello, I have a situation where I would like to perform custom serialization and deserialization of an existing .NET framework object (specifically, System.DateTime). Is there a common paradigm here, for how I can override the default behavior of DateTime serialization and provide my own? I want to use this custom serialized DateTime in many places, and don't want to provide custom serialization routines for every single object that...
0
9589
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...
1
9997
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
9865
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
7413
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
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
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...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
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
2815
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.