You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble creating a small reproducible test case. It doesn't help that it seems to be dependent on something at runtime as when I run all the of integration tests at once everything passes but if I run a specific subset two of them fail.
In a method to do database cleanup between integration tests I get exceptions for a couple tests when I remove either of the SaveChanges() calls in the code snippet below but if both are present it works fine.
System.InvalidCastException : Unable to cast object of type 'System.Int32' to type 'System.Int64'.
... A bunch of RemoveRange()
ctx.RemoveRange(ctx.RoleXPermission);
ctx.SaveChanges();
ctx.RemoveRange(ctx.UsersXAuthorizationGroup);
ctx.SaveChanges();
ctx.RemoveRange(ctx.AuthorizationGroupXRole);
... A couple more RemoveRange()
MySQL8.0.26 and 5.0.9 Execute “client.Database.EnsureCreatedAsync().Wait();” got same error. "One or more errors occurred. (Unable to cast object of type 'System.Int64' to type 'System.Int32'.)"
Include your code
I'm having trouble creating a small reproducible test case. It doesn't help that it seems to be dependent on something at runtime as when I run all the of integration tests at once everything passes but if I run a specific subset two of them fail.
In a method to do database cleanup between integration tests I get exceptions for a couple tests when I remove either of the SaveChanges() calls in the code snippet below but if both are present it works fine.
Include stack traces
Include provider and version information
EF Core version: 5.0.4
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: netstandard2.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.9.2
I've also asked a question on StackOverflow here https://stackoverflow.com/questions/66878339/ef-core-removerange-system-invalidcastexception-unable-to-cast-object-of-type
The text was updated successfully, but these errors were encountered: