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

ChangeTracker disposed in DbContext #35858

Closed
tdreiner opened this issue Mar 28, 2025 · 4 comments
Closed

ChangeTracker disposed in DbContext #35858

tdreiner opened this issue Mar 28, 2025 · 4 comments

Comments

@tdreiner
Copy link

Question

Hi, I just want to know if you have any know issues with the ChangeTracker in DbContext? I have a very strange problem which I've tried to solve the last 48h. I have one DbContext in a Winform. When I start the application the first time and open the Form everything works as expected. I close the the form and open it again. The DbContext and the ChangeTracker are initialized and everything works. After that I make the same change again on the reopened form and stop exactly in the first sub (Validating column) to debug before any other action is done. The DbContext lost the ChangeTracker and shows a Exception thrown: 'System.ObjectDisposedException' in Microsoft.EntityFrameworkCore.dll. But only for the ChangeTracker includes in the DbContext. The data is written to database correct although the exception is thrown. I already checked the callstack but I could not find any problems. I am using .net 9.0.3 and you latest built.

Thank you very much.
Thorsten

Your code

Stack traces


Verbose output


EF Core version

9.0.3

Database provider

No response

Target framework

No response

Operating system

No response

IDE

No response

@junyoung218
Copy link

.github/workflows/codeql-analysis.yml

@roji
Copy link
Member

roji commented Mar 28, 2025

This issue is lacking enough information for us to be able to fully understand what is happening. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

@tdreiner
Copy link
Author

The problem is that my project is very big. (1.6M lines) Perhaps I try to make a video of the behaviour and send the callstack at the first point I could fetch it?

@roji
Copy link
Member

roji commented Mar 28, 2025

@tdreiner what you'll need to do, is try to put together a minimal console program that reproduces the same behavior outside of your project - that is the standard requirement when submitting a bug report. While trying to write that minimal program, in most cases users find that they had some sort of bug in their actual code; if they don't and end up with an actual minimal program, that can be posted on the issue and executed by the maintainers (us) for investigation.

Please understand that a video recording does little to help us understand what you're doing or where the possible problem is coming from. You'll have to submit a repro.

@cincuranet cincuranet closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants