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

Change Tracker events lost on pooled context #27473

Closed
pinkfloydx33 opened this issue Feb 18, 2022 · 2 comments
Closed

Change Tracker events lost on pooled context #27473

pinkfloydx33 opened this issue Feb 18, 2022 · 2 comments
Assignees
Labels
area-dbcontext closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@pinkfloydx33
Copy link

pinkfloydx33 commented Feb 18, 2022

When using a pooled DbContext, the SavingChanges and SavedChanges event handlers are preserved between uses of a context. However event handlers added to the change tracker, ie ChangeTracker.Tracked and ChangeTracker.StateChanged are lost.

I have no idea if this is expected or not, but it does feel like a disconnect where one set of events is preserved and the other is not. I was unable to find documentation indicating the expected behavior for the events individually or as a whole.

I am not sure if this is a bug, working as intended or needs to be a potential feature request. If this indeed sounds like a bug I can provide a reproduction. I am on mobile at the moment so unable, but will follow-up accordingly.

Include provider and version information

EF Core version: 6.0.2
Database provider: Npgsql/Postgres
Target framework: NET 6.0

@ajcvickers
Copy link
Member

Note for triage: see #17086.

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Feb 22, 2022

This is a bug, we missed resetting ChangeTracker.Tracked and ChangeTracker.StateChanged to the saved values

@AndriySvyryd AndriySvyryd modified the milestones: 6.0.x, 7.0.0 Feb 22, 2022
ajcvickers added a commit that referenced this issue Jun 24, 2022
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jun 24, 2022
ajcvickers added a commit that referenced this issue Jun 24, 2022
ajcvickers added a commit that referenced this issue Jun 29, 2022
ajcvickers added a commit that referenced this issue Jun 29, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, 7.0.0-preview7 Jul 7, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0-preview7, 7.0.0 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dbcontext closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

No branches or pull requests

3 participants