473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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.SerializationExceptio n:
Possible Version mismatch. Type System.Collections.Comparer has 1 members,
number of members deserialized is 0.

at
System.Runtime.Serialization.Formatters.Binary.Rea dObjectInfo.GetMemberTypes(String[]
inMemberNames)
at System.Runtime.Serialization.Formatters.Binary.Obj ectMap..ctor(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.Obj ectMap.Create(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryObjectWit hMapTyped
record)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryHeaderEnu m
binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__B inaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.Obj ectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream)
at OptOutManager.Rules.Get(Int32 idx) in D:\Projects\Rules\Rules.cs:line
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 ConditionsOperatorEnum Operator = ConditionsOperatorEnum.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 2427
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
SerializationInfo 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.com

"Alexander" <za*****@lencom.com> wrote in message
news:ey**************@TK2MSFTNGP11.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.SerializationExceptio n:
Possible Version mismatch. Type System.Collections.Comparer has 1 members,
number of members deserialized is 0.

at
System.Runtime.Serialization.Formatters.Binary.Rea dObjectInfo.GetMemberTypes(String[]
inMemberNames)
at System.Runtime.Serialization.Formatters.Binary.Obj ectMap..ctor(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA,
Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.Obj ectMap.Create(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryObjectWit hMapTyped
record)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryHeaderEnu m
binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__B inaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.Obj ectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream)
at OptOutManager.Rules.Get(Int32 idx) in D:\Projects\Rules\Rules.cs:line
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 ConditionsOperatorEnum Operator = ConditionsOperatorEnum.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.Collections.Comparer" wich contains in
ArrayList(Conditions and Actions inherit it), how can i control
serialization of ArrayList?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP09.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
SerializationInfo 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.com

"Alexander" <za*****@lencom.com> wrote in message
news:ey**************@TK2MSFTNGP11.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.SerializationExceptio n:
Possible Version mismatch. Type System.Collections.Comparer has 1
members,
number of members deserialized is 0.

at
System.Runtime.Serialization.Formatters.Binary.Rea dObjectInfo.GetMemberTypes(String[]
inMemberNames)
at
System.Runtime.Serialization.Formatters.Binary.Obj ectMap..ctor(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA,
Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.Obj ectMap.Create(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryObjectWit hMapTyped
record)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryHeaderEnu m
binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__B inaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.Obj ectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream)
at OptOutManager.Rules.Get(Int32 idx) in
D:\Projects\Rules\Rules.cs:line
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 ConditionsOperatorEnum Operator = ConditionsOperatorEnum.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.com

"Alexander" <za*****@lencom.com> wrote in message
news:up**************@TK2MSFTNGP10.phx.gbl...
Yes, but error in "System.Collections.Comparer" wich contains in
ArrayList(Conditions and Actions inherit it), how can i control
serialization of ArrayList?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP09.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
SerializationInfo 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.com

"Alexander" <za*****@lencom.com> wrote in message
news:ey**************@TK2MSFTNGP11.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.SerializationExceptio n:
Possible Version mismatch. Type System.Collections.Comparer has 1
members,
number of members deserialized is 0.

at
System.Runtime.Serialization.Formatters.Binary.Rea dObjectInfo.GetMemberTypes(String[]
inMemberNames)
at
System.Runtime.Serialization.Formatters.Binary.Obj ectMap..ctor(String
objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA,
Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.Obj ectMap.Create(String
name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader,
Int32
objectId, BinaryAssemblyInfo assemblyInfo, SizedArray
assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryObjectWit hMapTyped
record)
at
System.Runtime.Serialization.Formatters.Binary.__B inaryParser.ReadObjectWithMapTyped(BinaryHeaderEnu m
binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__B inaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.Obj ectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream)
at OptOutManager.Rules.Get(Int32 idx) in
D:\Projects\Rules\Rules.cs:line
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 ConditionsOperatorEnum Operator = ConditionsOperatorEnum.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
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...
0
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...
4
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...
3
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...
4
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...
2
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...
1
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...
5
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.