[Mono-bugs] [Bug 82400][Nor] Changed - DateTime binary serialization incompatible with MS.NET 2.0

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Aug 15 13:52:44 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jaebird at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=82400

--- shadow/82400	2007-08-15 10:00:31.000000000 -0400
+++ shadow/82400.tmp.21532	2007-08-15 13:52:44.000000000 -0400
@@ -63,6 +63,35 @@
 
 
 ------- Additional Comments From jaebird at gmail.com  2007-08-15 10:00 -------
 Created an attachment (id=19815)
 Lionel's patch, updated for a more current svn rev
 
+
+------- Additional Comments From jaebird at gmail.com  2007-08-15 13:52 -------
+This is NOT a fix, but a total HACK to get passed this issue until it
+is fixed. I modified the ctor that takes "ticks" as shown:
+
+public DateTime (long ticks)
+{
+#if NET_2_0
+  ulong leftpart = (ulong)ticks & 0xc000000000000000;
+  ticks = (long)(leftpart ^ (ulong)ticks);
+
+  // If we do nothing, we let kind = 0 (ie Unspecified)
+  if (leftpart == 0)
+    this.kind = DateTimeKind.Unspecified;
+  else if (leftpart == 0x4000000000000000)
+    this.kind = DateTimeKind.Utc;
+  else
+    this.kind = DateTimeKind.Local;
+#endif
+
+  this.ticks = new TimeSpan (ticks);
+  if (ticks < MinValue.Ticks || ticks > MaxValue.Ticks) {
+    string msg = Locale.GetText ("Value {0} is outside the valid range
+[{1},{2}].", 
+      ticks, MinValue.Ticks, MaxValue.Ticks);
+    throw new ArgumentOutOfRangeException ("ticks", msg);
+  }
+}
+


More information about the mono-bugs mailing list