-
Notifications
You must be signed in to change notification settings - Fork 757
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
Reset database object during the Dispose method #3553
Conversation
This doesn't seem like an appropriate solution. In general nulling out fields in Dispose leads to race conditions and null reference exceptions. The assumption in #3531 that you should be able to call Dispose to disconnect and then call other methods and have it reconnect does not match the proper use of the Dispose pattern. Proposal: Dispose should set an internal _disposed bool field and any APIs called after should check that field and throw ObjectDisposedException. |
What do you think about this dotnet/runtime#42183 |
Unnecessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better.
Hello @Tratcher! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
* Reset database object during the Dispose method * Throw ObjectDisposedException when object has already disposed\n\nCommit migrated from dotnet/extensions@6683bac
Reset database object during the Dispose method
Fixes #3531
Please review,
Thank you in advance