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

Home Posts Topics Members FAQ

Serialization in Mono

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.Argument OutOfRangeExcep tion: Value -859032199088540 0808 is
outside the valid range [0,3155378975999 999999].
Parameter name: ticks
at System.DateTime ..ctor (Int64 ticks) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadPrimitiv
eTypeValue (System.IO.Bina ryReader reader, System.Type type) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadValue
(System.IO.Bina ryReader reader, System.Object parentObject, Int64
parentObjectId, System.Runtime. Serialization.S erializationInf o info,
System.Type valueType, System.String fieldName,
System.Reflecti on.MemberInfo memberInfo, System.Int32[] indices)
[0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadObjectCo
ntent (System.IO.Bina ryReader reader,
System.Runtime. Serialization.F ormatters.Binar y.TypeMetadata metadata,
Int64 objectId, System.Object& objectInstance,
System.Runtime. Serialization.S erializationInf o& info) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadObjectIn
stance (System.IO.Bina ryReader reader, Boolean isRuntimeObject , Boolean
hasTypeInfo, System.Int64& objectId, System.Object& value,
System.Runtime. Serialization.S erializationInf o& info) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadObject
(BinaryElement element, System.IO.Binar yReader reader, System.Int64&
objectId, System.Object& value,
System.Runtime. Serialization.S erializationInf o& info) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadNextObje
ct (System.IO.Bina ryReader reader) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadObjectGr
aph (System.IO.Bina ryReader reader, Boolean readHeaders, System.Object&
result, System.Runtime. Remoting.Messag ing.Header[]& headers) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.NoCheckDe
serialize (System.IO.Stre am serializationSt ream,
System.Runtime. Remoting.Messag ing.HeaderHandl er handler) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Deseriali
ze (System.IO.Stre am serializationSt ream) [0x00000]
at LanguageSystem. WordDisplay.ope nFileDialog1_Fi leOk (System.Object
sender, System.Componen tModel.CancelEv entArgs e) [0x00000]
at (wrapper delegate-invoke)
System.Multicas tDelegate:invok e_void_object_C ancelEventArgs
(object,System. ComponentModel. CancelEventArgs )
at System.Windows. Forms.FileDialo g.OnFileOk
(System.Compone ntModel.CancelE ventArgs e) [0x00000]
at System.Windows. Forms.FileDialo g.OnClickOpenSa veButton
(System.Object sender, System.EventArg s e) [0x00000]
at System.Windows. Forms.FileDialo g.OnForceDialog EndFileView
(System.Object sender, System.EventArg s e) [0x00000]
at (wrapper delegate-invoke)
System.Multicas tDelegate:invok e_void_object_E ventArgs
(object,System. EventArgs)
at System.Windows. Forms.MWFFileVi ew.OnDoubleClic k (System.EventAr gs e)
[0x00000]
at System.Windows. Forms.ListView+ ItemControl.Ite msMouseDown
(System.Object sender, System.Windows. Forms.MouseEven tArgs me) [0x00000]
at (wrapper delegate-invoke)
System.Multicas tDelegate:invok e_void_object_M ouseEventArgs
(object,System. Windows.Forms.M ouseEventArgs)
at System.Windows. Forms.Control.O nMouseDown
(System.Windows .Forms.MouseEve ntArgs e) [0x00000]
at System.Windows. Forms.Control.W ndProc (System.Windows .Forms.Message&
m) [0x00000]
at System.Windows. Forms.ListView+ ItemControl.Wnd Proc
(System.Windows .Forms.Message& m) [0x00000]
at System.Windows. Forms.Control+C ontrolNativeWin dow.WndProc
(System.Windows .Forms.Message& m) [0x00000]
at System.Windows. Forms.NativeWin dow.WndProc (IntPtr hWnd, Msg msg,
IntPtr wParam, IntPtr lParam) [0x00000]

I've been trying to figure out what went wrong, but I can't see it. Any
ideas?

--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
May 15 '07 #1
5 6117
On Tue, 15 May 2007 17:27:58 +0200, Nikola Skoric <ni*******@net4 u.hr>
wrote:

Look at the first error in the hierarchy - all the others just tell
you that one of their subroutines failed.
>System.Argumen tOutOfRangeExce ption: Value -859032199088540 0808 is
outside the valid range [0,3155378975999 999999].
Parameter name: ticks
at System.DateTime ..ctor (Int64 ticks) [0x00000]
It looks llike you have an invalid number of ticks where the app is
trying to reconstruct a DateTime using a constructor with a single
Int64 parameter of the number of ticks.

Check for file corruption, or for an improperly constructed file.

rossum

May 15 '07 #2
On Tue, 15 May 2007 08:27:58 -0700, Nikola Skoric <ni*******@net4 u.hr>
wrote:
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.Argument OutOfRangeExcep tion: Value -859032199088540 0808 is
outside the valid range [0,3155378975999 999999].
Parameter name: ticks
at System.DateTime ..ctor (Int64 ticks) [0x00000]
at
System.Runtime. Serialization.F ormatters.Binar y.ObjectReader. ReadPrimitiv
eTypeValue (System.IO.Bina ryReader reader, System.Type type) [0x00000]
[...]
Well, at first glance it appears to be a signed/unsigned mismatch. But, I
suppose it's also possible that the exception output is incorrectly
formatting the input value and that it's simply a genuine "your number is
too big" exception.

What I would do is take the maximum value described in the range
(31553789759999 99999) and set a DateTime object to that to see what actual
date and time that corresponds to. Then look at the input data and see if
you can figure out why it's resulting in a tick count
(-859032199088540 0808) that's outside the allowed range.

Somewhere you're reading a date/time value that the Mono version of
DateTime doesn't like. This may be because the Mono DateTime doesn't
handle the same range as the .NET DateTime, it might be because of some
sort of byte-swapping issue (depending on what you're running Mono on), it
might be because of some data structure packing or alignment problem, or
something else entirely. But the first step would be to figure out if the
numbers you're seeing in the exception make any sense (and at first
glance, having a negative number where only positive numbers are allowed
doesn't make sense :) ).

Pete
May 15 '07 #3
In article <op************ ***@petes-computer.local> ,
Np*********@nno wslpianmk.com says...
What I would do is take the maximum value described in the range
(31553789759999 99999) and set a DateTime object to that to see what actual
date and time that corresponds to. Then look at the input data and see if
you can figure out why it's resulting in a tick count
(-859032199088540 0808) that's outside the allowed range.
Thanks, Pete, you have been very helpful. It turns out that
d = DateTime.FromBi nary(3155378975 999999999);
Console.WriteLi ne(d);
returns 31.12.9999 23:59:59. And
d = DateTime.Now;
Console.WriteLi ne(d.ToBinary() );
returns
-859022352112594 9343

Now, it seems like Mono and .NET Framework have some big compatibility
issues here...

--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
May 15 '07 #4
On Tue, 15 May 2007 20:55:11 +0200, Nikola Skoric <ni*******@net4 u.hr>
wrote:
>In article <op************ ***@petes-computer.local> ,
Np*********@nn owslpianmk.com says...
>What I would do is take the maximum value described in the range
(3155378975999 999999) and set a DateTime object to that to see what actual
date and time that corresponds to. Then look at the input data and see if
you can figure out why it's resulting in a tick count
(-859032199088540 0808) that's outside the allowed range.

Thanks, Pete, you have been very helpful. It turns out that
d = DateTime.FromBi nary(3155378975 999999999);
Console.WriteL ine(d);
returns 31.12.9999 23:59:59. And
d = DateTime.Now;
Console.WriteL ine(d.ToBinary( ));
returns
-859022352112594 9343

Now, it seems like Mono and .NET Framework have some big compatibility
issues here...
You original error messsage talked about "ticks" - the Mono
constructor seemed to need Ticks as input. What does d.Ticks return?
Is that number within the expected range?

The documentation for DateTime mentions both ToBinary() and
FromBinary() to serialize and deserialize a DateTime object. Are you
trying to serialize with ToBinary() and deserialize with a
constructor?

Try deserializing with FromBinary(), that might work better.

rossum
May 15 '07 #5
On Tue, 15 May 2007 13:49:52 -0700, rossum <ro******@coldm ail.comwrote:
[...]
The documentation for DateTime mentions both ToBinary() and
FromBinary() to serialize and deserialize a DateTime object. Are you
trying to serialize with ToBinary() and deserialize with a
constructor?

Try deserializing with FromBinary(), that might work better.
Or conversely, serializing with the Ticks property. Though, since you're
serializing to a binary data storage, I'd say the previous suggestion is
probably better (use FromBinary()). Just offering alternatives. :)

Either way, that may well be the problem.

Pete
May 15 '07 #6

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

Similar topics

3
7957
by: Raseliarison nirinA | last post by:
hi all, i found an unanswered question at http://www.faqts.com/knowledge_base/index.phtml/fid/538 with possible response below. i've tried to send it at faqt.python but can't figure out how to edit the page. so i put it here. i want to kwon if this can convert all wave file. is there other encodage than 8 or 16 bits for .wav files? any bug and comment are welcome --
11
661
by: Tony Baker | last post by:
In order for my company to go ahead and use .Net and C# (over java), I need to know how to install and run a C# ASP.Net application not only on Windows, but on Linux. I'm a Windows developer, currently writing a c# ASP.Net application. The last time I used Linux (or whatever you want to call it) was back at Uni 5 years ago. What I want to do, is to see if I can get my ASP.Net project working on Linux using mono (www.mono-project.com) -...
5
2284
by: fliversen | last post by:
Hello, does anyone have successfull experience with mono on Windows. I have download mono-1.0.1-gtksharp-1.0-win32-0.5.exe But to compile und run programs whitch use Gtk# is not possible: The result is error CS0006: Cannot find assembly `gtk-sharp.dll'
0
1348
by: John Bailo | last post by:
http://www.onlamp.com/pub/wlg/7468 "Mono Live was released on May 24, 2005. Although there are several Live Linux CDs with Mono, they are all based on Knoppix and use KDE as the default Linux desktop. This distribution is based on the Ubuntu Live Linux CD. In many ways, the outstanding experience available from the Mono Live CD is made possible from Ubuntu. Since Ubuntu features GNOME as the default desktop, it only follows that due to...
2
2260
by: Mike Schilling | last post by:
Is there an official specification for .NET serialization? I've looked at the .NET framework docs and read Jeffrey Richter's MSDN articles, but I'm looking for something more complete, corresponding to the specification of Java serialization found at http://java.sun.com/products/jdk/1.2/docs/guide/serialization/spec/serialTOC.doc.html
1
1585
by: Silesian | last post by:
I realize that this is a newbie question but maybe someone will be able to tell me what am I doing wrong. createFile() gets called each time I have the user generate some numbers which then get added to the binlist ArrayList. I'm able to serialize and deserialize the Arraylist. However, when I deserialize the ArrayList, it will only show the first set of ints. I looked at the bin file and it does get appended to each time. Any help will...
1
1687
by: Joannes Vermorel | last post by:
I am having a serialization problem with a simple piece of code (short & complete) available at http://www.vermorel.com/opensource/NGridBugDemo.cs . When I run this code, I get a SerializationException ("ServerIdentity is not marked as serializable"). This is very bizarre since ServerIdentity is supposed to be serializable (have a look a Rotor, http://www.123aspx.com/rotor/RotorSrc.aspx?rot=41866). This problem is a trully annoying one....
6
1603
by: Twig | last post by:
Hi, Can I use strictly for C# development without missing anything from MS? Twig
2
3162
by: flagos | last post by:
Hi to all! Any of you know if it's possible to use the Cairo graphics library in a WIN32 c# application? I know there is a binding made for Mono but my app will run on win32 so obviously I wont need Mono. Any help will be appreciated. Thanks!
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...
0
9423
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
10219
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
9998
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,...
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
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
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.