-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
SavingChanges in EF Core 5.0 thrown System.NotSupportedException: #22841
Comments
@loveprogrammin Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate. |
this is the classes
and the second class
and the DbContext
and the LevelConfiguration is
and the LevelOneConfiguration is
I hope that will help |
@loveprogrammin I don't think the issue is related to your EF configuration or model. I don't think there will be much we can do without the executable code that sets up the the appropriate situation to generates the exception. |
EF Team Triage: This issue is still lacking enough information for us to be able to effectively triage it. Once you provide a small, runnable project or post a small, runnable code listing that reproduces what you are seeing we can investigate and reopen this issue. |
this is a runnable project https://1drv.ms/u/s!ApQ9UD_gEQ2qgbEjko4z-HIvUkWaiQ?e=ulXh0y Make sure before you run the application to uncomment the lines inside LoadAsync() method in MainWindowViewModel to add the data to the Database. After that run the app and try to remove last subchild in the treeview using the contextMenu |
@dotnet/efteam This requires Windows to repro. Can somebody try? |
This is a consequence of #10164 @loveprogrammin Change the public async Task SaveChangesAsync()
{
await context.SaveChangesAsync(acceptAllChangesOnSuccess: false);
context.ChangeTracker.AcceptAllChanges();
} This will make EF modify the model collections on the current (Dispatcher) thread. |
Thanks it's work 😀 However, if you try removing entity and its throws exception , nothing will be save and that is the right. After that .if I try to remove another entity and on exception thrown ,saving changes will remove both entity the one that had exception and the other one with no exception. |
@AndriySvyryd reopened to discuss if we should add additional documentation here. |
Yes, we should add a note to the WPF tutorial |
I think removing entity is another problem |
We should also add some documentation to our async programming page (I can do that). |
I not sure if this going to produce other problems but I reset the context before removing item and it works |
After I upgraded form ef core 3.1 to ef core 5.0.0-rc , I got a System.NotSupportedException: 'This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.'. it happened when I save changes after removing an entity
The text was updated successfully, but these errors were encountered: