Skip to content
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

Replacing PK to PK dependent with different type fails using in-memory provider #29875

Closed
ajcvickers opened this issue Dec 16, 2022 · 1 comment
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.

Comments

@ajcvickers
Copy link
Contributor

Same scenario as #29789, except that this also did not work in EF Core 6.0 and uses the in-memory provider.

Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException
Attempted to update or delete an entity that does not exist in the store.
   at Microsoft.EntityFrameworkCore.InMemory.Storage.Internal.InMemoryTable`1.Delete(IUpdateEntry entry, IDiagnosticsLogger`1 updateLogger) in C:\github\efcore\src\EFCore.InMemory\Storage\Internal\InMemoryTable.cs:line 229
   at Microsoft.EntityFrameworkCore.InMemory.Storage.Internal.InMemoryStore.ExecuteTransaction(IList`1 entries, IDiagnosticsLogger`1 updateLogger) in C:\github\efcore\src\EFCore.InMemory\Storage\Internal\InMemoryStore.cs:line 179
   at Microsoft.EntityFrameworkCore.InMemory.Storage.Internal.InMemoryDatabase.SaveChangesAsync(IList`1 entries, CancellationToken cancellationToken) in C:\github\efcore\src\EFCore.InMemory\Storage\Internal\InMemoryDatabase.cs:line 67
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken) in C:\github\efcore\src\EFCore\ChangeTracking\Internal\StateManager.cs:line 1264
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) in C:\github\efcore\src\EFCore\ChangeTracking\Internal\StateManager.cs:line 1363
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) in C:\github\efcore\src\EFCore\DbContext.cs:line 771
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) in C:\github\efcore\src\EFCore\DbContext.cs:line 793
   at Microsoft.EntityFrameworkCore.UpdatesTestBase`1.<>c__DisplayClass6_0.<<Can_change_type_of_pk_to_pk_dependent_by_replacing_with_new_dependent>b__1>d.MoveNext() in C:\github\efcore\test\EFCore.Specification.Tests\UpdatesTestBase.cs:line 78
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.TestUtilities.TestHelpers.<>c__DisplayClass35_0`1.<<ExecuteWithStrategyInTransactionAsync>b__0>d.MoveNext() in C:\github\efcore\test\EFCore.Specification.Tests\TestUtilities\TestHelpers.cs:line 361
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__7`1.<<ExecuteAsync>b__7_0>d.MoveNext() in C:\github\efcore\src\EFCore\Storage\ExecutionStrategyExtensions.cs:line 238
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.TestUtilities.TestHelpers.ExecuteWithStrategyInTransactionAsync[TContext](Func`1 createContext, Action`2 useTransaction, Func`2 testOperation, Func`2 nestedTestOperation1, Func`2 nestedTestOperation2, Func`2 nestedTestOperation3) in C:\github\efcore\test\EFCore.Specification.Tests\TestUtilities\TestHelpers.cs:line 343
   at Microsoft.EntityFrameworkCore.UpdatesInMemoryTestBase`1.ExecuteWithStrategyInTransactionAsync(Func`2 testOperation, Func`2 nestedTestOperation1, Func`2 nestedTestOperation2) in C:\github\efcore\test\EFCore.InMemory.FunctionalTests\UpdatesInMemoryTestBase.cs:line 42
   at Microsoft.EntityFrameworkCore.UpdatesTestBase`1.Can_change_type_of_pk_to_pk_dependent_by_replacing_with_new_dependent(Boolean async) in C:\github\efcore\test\EFCore.Specification.Tests\UpdatesTestBase.cs:line 66
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_0.<<InvokeTestMethodAsync>b__1>d.MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 264
--- End of stack trace from previous location ---
   at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in /_/src/xunit.execution/Sdk/Frameworks/ExecutionTimer.cs:line 48
   at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 90
@ajcvickers
Copy link
Contributor Author

We recommend against using the in-memory provider for testing--see Testing EF Core Applications. While we have no plans to remove the in-memory provider, we will not be adding any new features to this provider because we believe valuable development time is better spent in other areas. When feasible, we plan to still fix regressions in existing behavior.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2022
@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.
Projects
None yet
Development

No branches or pull requests

1 participant