You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (JIRA)" <ji...@apache.org> on 2015/10/14 11:24:05 UTC

[jira] [Updated] (IGNITE-1644) .Net: DateTime.Kind is lost during serialization

     [ https://issues.apache.org/jira/browse/IGNITE-1644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel  Tupitsyn updated IGNITE-1644:
------------------------------------
    Description: 
For example, we write and then read from the same stream (locally):

{code}
var dt = DateTime.Now;
writer.WriteObject(dt);

var dt2 = reader.ReadObject<DateTime>();
Assert.AreEqual(dt, dt2);  // fail
{code}

This happens because we always write DateTime as UTC and lose DateTime.Kind, so on deserialization we do not know whether ToLocal should be called.

Possible solutions:
* write .Net DateTime in a different format, not compatible with Java (breaks queries)
* throw exceptions for non-utc DateTime (force user to use UTC-only during serialization)


  was:
For example, we write and then read from the same stream (locally):

{code}
var dt = DateTime.Now;
writer.WriteObject(dt);

var dt2 = reader.ReadObject<DateTime>();
Assert.AreEqual(dt, dt2);  // fail
{code}

This happens because we always write DateTime as UTC and lose DateTime.Kind, so on deserialization we do not know whether ToLocal should be called.

Possible solutions:
* write .Net DateTime in a different format, not compatible with Java (breaks queries)
* 



> .Net: DateTime.Kind is lost during serialization
> ------------------------------------------------
>
>                 Key: IGNITE-1644
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1644
>             Project: Ignite
>          Issue Type: Bug
>          Components: interop
>    Affects Versions: 1.5
>            Reporter: Pavel  Tupitsyn
>            Assignee: Pavel  Tupitsyn
>             Fix For: 1.5
>
>
> For example, we write and then read from the same stream (locally):
> {code}
> var dt = DateTime.Now;
> writer.WriteObject(dt);
> var dt2 = reader.ReadObject<DateTime>();
> Assert.AreEqual(dt, dt2);  // fail
> {code}
> This happens because we always write DateTime as UTC and lose DateTime.Kind, so on deserialization we do not know whether ToLocal should be called.
> Possible solutions:
> * write .Net DateTime in a different format, not compatible with Java (breaks queries)
> * throw exceptions for non-utc DateTime (force user to use UTC-only during serialization)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)