[Mono-dev] Remoting with DateTime
robertj at gmx.net
Tue Aug 14 19:51:40 EDT 2007
Jae Stutzman wrote:
> Ok added bug# 82400 to help track this. I've been playing with Lionel's
> patch. What i've found out so far is that the ObjectReader from
> System.Runtime.Serialization.Formatters.Binary has a method that is executed
> when trying to de-serialize the DateTime struct. The method is
> ReadPrimitiveTypeValue, which has a case:
> case TypeCode.DateTime:
> return new DateTime (reader.ReadInt64());
> This is causing an explosion because now the DateTimeKind is included. This
> is quite a mess at present. Needless to say if you try to remote a DateTime
> that has a kind of Local or Utc it will die. The ObjectReader is not using
> the ISerializable interface, just calling the DateTime ctor with "ticks",
> but they are not ticks yet!
> I'll keep looking, but someone familiar with why it was done this way should
> speak up if possible.
This is part of the binary serialization formatter's undocumented
specification: DateTime is treated as a primitive type and only
its ticks are serialized.
It looks like the format has changed with 2.0, so someone would
have to reverse engineer this part again.
The old spec can be found in the source tree:
More information about the Mono-devel-list