-
-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BulkSaveChanges throws "is already being tracked" exception #1628
Comments
I ran into this and spent so much time looking for a solution. The only solution I found for this problem is to attach the entitie after calling
This method is buggy. |
What version of lib are you using, and it this for SqlServer?
|
I am also experiencing this issue on SqlServer with EFCore.BulkExtensions 9.0.0-rc.1 after upgrading from .NET 8 to 9: "The instance of entity type 'DirectoryHash' cannot be tracked because another instance with the key value '{DirectoryHashId: 4343}' is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached." This occurs when I modify or add my DirectoryHash entities, call |
I'm using the following code:
On the normal SaveChanges (The second one) call I get the following exception:
System.InvalidOperationException: The instance of entity type 'TranslationEntity' cannot be tracked because another instance with the key value '{Id: 5652fb85-6fbc-40fd-4914-08dd152b7ad7}' is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached.
This probably means that it tries to track this entity again somehow. Is it possible to combine both methods in sequence?
The text was updated successfully, but these errors were encountered: