Bug #102353 Summation error (Sum) in Entity Framework and MySQL
Submitted: 23 Jan 11:57 Modified: 5 May 12:47
Reporter: Dmitrii Baranov Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version: OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: entity framework

[23 Jan 11:57] Dmitrii Baranov
Description:
I use MySQL & Entity Framework (NET 5 / NET Core 3.1). I have a ‘Users’ table created based on the ‘User’ class:

public class User
{
        public int Id { get; set; }
        public string Name { get; set; }
        public int Age { get; set; } // int!
}

I can sum up the ages of all users:

var result = dbContext.Users.Sum(s => s.Age); // Ok

But, if the Age property is short or byte, then there will be an error. Why can't I sum fields like short or byte?!

I use for NET Core 3.1:
 - Microsoft.EntityFrameworkCore 3.1.11
 - MySql.Data.EntityFrameworkCore 8.0.22

I use for NET 5:
 - Microsoft.EntityFrameworkCore 5.0.2
 - MySql.EntityFrameworkCore 5.0.0-m8.0.23

How to repeat:
I use MySQL & Entity Framework (NET 5 / NET Core 3.1). I have a ‘Users’ table created based on the ‘User’ class:

public class User
{
        public int Id { get; set; }
        public string Name { get; set; }
        public int Age { get; set; } // int!
}

I can sum up the ages of all users:

var result = dbContext.Users.Sum(s => s.Age); // Ok

But, if the Age property is short or byte, then there will be an error. Why can't I sum fields like short or byte?!

I use for NET Core 3.1:
 - Microsoft.EntityFrameworkCore 3.1.11
 - MySql.Data.EntityFrameworkCore 8.0.22

I use for NET 5:
 - Microsoft.EntityFrameworkCore 5.0.2
 - MySql.EntityFrameworkCore 5.0.0-m8.0.23
[5 Apr 12:47] MySQL Verification Team
Hello Dmitrii Baranov,

Thank you for the bug report.
Could you please provide complete repeatable test case (sample project, etc. - please make it as private if you prefer) to confirm this issue at our end?

Regards,
Ashwini Patil
[6 May 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".