EfCore 5 Update method throws "Unable to cast object of type 'System.Int32' to type 'System.Int64'." #24221
Labels
area-save-changes
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
regression
Servicing-approved
type-bug
Milestone
After upgrading from EFcore 3.1 to EFcore 5.0.3, some manipulations of Entities started to throw "Unable to cast object of type 'System.Int32' to type 'System.Int64'.".
Code Example
On the following Code, the line of "SaveChangesAsync()" throw "Unable to cast object of type 'System.Int32' to type 'System.Int64'.", but works fine in EFcore 3.1 full example :
Note that only values/rows were Deleted.
Stacktrace
Sorry for the Sample, I did my best converting my real project to an understandable Code.
Provider and version information
EF Core version: 5.0.3
Database provider: Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Sqlite
Target framework: NET 5.0
Operating system: Windows 10 Pro
IDE: Visual Studio 2019 16.8.4
The text was updated successfully, but these errors were encountered: