473,386 Members | 1,924 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,386 software developers and data experts.

Serialization

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
--
Best regards,
Alexander Zaharov
msn: az******@hotmail.com
icq: 230553120

Nov 16 '05 #1
4 3255
Alexander <za*****@lencom.com> wrote:
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


I'm afraid your question isn't very clear at all.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
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 <za*****@lencom.com> wrote:
When i store rule on PC with .NET.SP1 i cant restore them from PC without
SP1.


Right. Effectively, you've got different versions of ArrayList. I'm not
entirely surprised serialization doesn't work in this case, to be
honest. Not sure that the error message is as useful as it could be,
but I think it's generally unlikely that serialization will work
between different versions of the framework. Then again, I'm not a
serialization expert by any stretch of the imagination.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Right. Effectively, you've got different versions of ArrayList. I'm not
entirely surprised serialization doesn't work in this case, to be
honest. Not sure that the error message is as useful as it could be,
but I think it's generally unlikely that serialization will work
between different versions of the framework.


I would think that if the serialized bits are going to be persisted to disk
it would be best (safest) policy to do your own serialization. You would
also want to be sure to store a version number in the image so that later
versions can restore successfully.

-- Alan
Nov 16 '05 #5

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...
1
by: andrewcw | last post by:
There is an error in XML document (1, 2). I used XML spy to create the XML and XSD. When I asked to have the XML validated it said it was OK. I used the .net SDK to generate the class. I have...
3
by: Aaron Clamage | last post by:
Hi, I'm not sure that if this is the right forum, but any help would be greatly appreciated. I am porting some java serialization code to c# and I can't figure out the correct way to do it. ...
6
by: Uttam | last post by:
Hello, We are at a very crucial decision making stage to select between .Net and Java. Our requirement is to download a class at runtime on the client computer and execute it using remoting or...
3
by: Alexander | last post by:
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.SerializationException: Possible Version mismatch. Type...
4
by: mijalko | last post by:
Hi, I have inherited my class from System.Drawing.Printing.PrintDocument and I wish to serialize this object using XmlSerializer. And I get exception "There was an error reflecting type ...". If I...
5
by: Nikola Skoric | last post by:
I ran in Mono a program developed on .NET Framework 2.0 and it ran OK until I tried to desirialize a object. There the program died abruptly dumping this: System.ArgumentOutOfRangeException:...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
1
by: kikisan | last post by:
I am developing a windows service which utilizes the following classes: interface IPersistable; abstract class PersistableObject : IPersistable;
2
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.