Bug #92484 Floats/doubles/decimals are converted inccorectly when using Entity Framework 6
Submitted: 18 Sep 2018 14:58 Modified: 29 Feb 2020 0:13
Reporter: Rene Steen Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.10.7 OS:Windows
Assigned to: CPU Architecture:Any
Tags: EF6, Entity Framework 6

[18 Sep 2018 14:58] Rene Steen
Description:
When having multiple includes in an EF query it seems like sometimes floats, doubles and decimal values are converted wrongly for example:
float 6.4 becomes 6.4E+15 in .Net
double 6.4 becomes 6.4E+15
decimal(18,2) 6.4 becomes 640.0 

It seems like also this is related to the order of the includes:
var employees = db.Employees.AsNoTracking().Include(x => x.WorkingTimeHistory).Include($"{nameof(WorkingTimeHistory)}.{nameof(WorkingTimes)}").Include(x => x.SalaryHistory).Include(x => x.Absences).Include(x => x.Company).Include(x => x.ContactPerson).Include(x => x.BankAccount).Include(x => x.AssociatedChildren).Include(x => x.Departments).Include(x => x.CostCodes).Include(x => x.Address).OrderBy(x => x.Lastname + ", " + x.Firstname).ToList();

returns the data correctly where as 

var employees = db.Employees.AsNoTracking().Include(x => x.Address).Include(x => x.SalaryHistory).Include(x => x.Absences).Include(x => x.Company).Include(x => x.WorkingTimeHistory).Include(x => x.ContactPerson).Include(x => x.BankAccount).Include(x => x.Departments).Include(x => x.CostCodes).Include(x => x.AssociatedChildren).Include($"{nameof(WorkingTimeHistory)}.{nameof(WorkingTimes)}").OrderBy(x => x.Lastname + ", " + x.Firstname).ToList();

does these strange conversion

How to repeat:
Create loads of data models and create a query to include all these nested properties.

Suggested fix:
Do not convert floats/doubles/decimals to something strange...
[18 Sep 2018 15:14] Rene Steen
Visual studio error1

Attachment: error_1.png (image/png, text), 15.03 KiB.

[18 Sep 2018 15:14] Rene Steen
Visual studio error1

Attachment: error_1.png (image/png, text), 15.03 KiB.

[18 Sep 2018 15:14] Rene Steen
error_2

Attachment: error_2_correct.png (image/png, text), 14.07 KiB.

[18 Sep 2018 15:15] Rene Steen
database

Attachment: sql_output.png (image/png, text), 14.74 KiB.

[18 Sep 2018 16:04] Rene Steen
critical as it seems like as soon as i change the order, other properties like floats from the absences table start to be 5.0 instead of 0.5