pizheng / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

DateTime Kind changing during serialization/deserialization round trip #146

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please include an e-mail address if this might need a dialogue!
==============

What steps will reproduce the problem?
1. Serialize a DateTime that has Kind=Utc
2. Deserialize and Kind will now be be Unspecified

What is the expected output? What do you see instead?

The value of the Kind field should be preserved.

What version of the product are you using? On what operating system?

1.0.0.282 (bundled with Lokad-CQRS)
Windows

Please provide any additional information below.

Original issue reported on code.google.com by crai...@gmail.com on 3 Dec 2010 at 3:17

GoogleCodeExporter commented 9 years ago
Is there some way around this?
Can we set a special serializer/deserializer for DateTime that will convert it 
to Utc (DateTime.ToUniversalTime()) upon serializing and assume it it Utc when 
deserializing?

I know there are hooks to set a custom factory method for classes, but I don't 
know how that would work for immutable objects like DateTime.

Original comment by l...@virtuoz.com on 23 Feb 2012 at 2:05