Double.NaN is stored and retrieved as null (EF6 Code First)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Double.NaN is stored and retrieved as null (EF6 Code First)

Post by bairog » Tue 18 Sep 2018 09:31

Hello.
Assume we have the following entity:

Code: Select all

    public class User
    {
        public Guid Id { get; set; }
        public String Name { get; set; }
        public Double? Age { get; set; }  
    } 
User with Age=Double.NaN is stored to database and retrieved from it as null (column type is real, null is allowed).
User with Age=null is also stored to database and retrieved from it as null (that works as I expect).
Double.PositiveInfinity and Double.NegativeInfinity are also saved and retrieved correctly.

So why Double.NaN is not working?

I use dotConnect for SQLite 5.11.1202.
Last edited by bairog on Tue 08 Oct 2019 14:54, edited 3 times in total.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Double.NaN is stored and retrieved as null (EF Code First)

Post by Shalex » Sat 22 Sep 2018 17:29

Thank you for your report. You are working with EF6, aren't you? We have reproduced the issue. We will investigate it and notify you about the result.

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Double.NaN is stored and retrieved as null (EF Code First)

Post by bairog » Wed 24 Oct 2018 05:07

Yes, I use EF6.
So how is your investigation going?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Double.NaN is stored and retrieved as null (EF6 Code First)

Post by Shalex » Fri 26 Oct 2018 18:20

The investigation is in progress. As soon as we have any result, we will let you know.

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Double.NaN is stored and retrieved as null (EF6 Code First)

Post by bairog » Tue 08 Oct 2019 07:59

Hello again.
Is there a workaround for today? We really need to read Double.NaN.
Thank you.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Double.NaN is stored and retrieved as null (EF6 Code First)

Post by Shalex » Sat 12 Oct 2019 15:46

There is no workaround for EF6.

EF Core 2 allows solving the issue with a value converter (store value as a string).

Post Reply