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

Microsoft.Data.Sqlite: Consider being strict about requiring disposal of DbCommands #13836

Closed
ajcvickers opened this issue Apr 27, 2018 · 6 comments
Labels
area-adonet-sqlite breaking-change closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. type-enhancement

Comments

@ajcvickers
Copy link
Contributor

ajcvickers commented Apr 27, 2018

This would be a breaking change, but would have the advantage of cleaning up code like that in aspnet/Microsoft.Data.Sqlite#506.

@bricelam
Copy link
Contributor

bricelam commented Jun 6, 2018

Note, we're going to make this change early in the 3.0 timeframe so customers have plenty of opportunity to provide feedback.

@jogibear9988
Copy link

What does this mean? Do we need to Dispose every Command after the change?

@bricelam
Copy link
Contributor

bricelam commented Aug 21, 2018

Since DbCommand implements IDisposable, yes, they should be disposed. Unfortunately, many ADO.NET users got into the habit of not disposing of them since some popular providers don't require it. We currently compensate for this misuse by disposing of any, when disposing the connection, which haven't been finalized by the garbage collector.

@bricelam
Copy link
Contributor

Removing this code could lead to more zombied connections and database files being locked longer.

@ajcvickers ajcvickers transferred this issue from aspnet/Microsoft.Data.Sqlite Oct 31, 2018
@ajcvickers ajcvickers added this to the 3.0.0 milestone Oct 31, 2018
@ajcvickers ajcvickers changed the title Consider being strict about requiring disposal of DbCommands Microsoft.Data.Sqlite: Consider being strict about requiring disposal of DbCommands Oct 31, 2018
@ajcvickers
Copy link
Contributor Author

Consider guidance for other ADO.NET providers in this area. /cc @roji @divega

@bricelam
Copy link
Contributor

The architecture I have in mind for #14044 will remove the need to dispose SqliteCommand objects. It will also allow them to be disposed while their SqliteDataReader is open.

@bricelam bricelam removed this from the 3.0.0 milestone Jan 31, 2019
@bricelam bricelam removed their assignment Jan 31, 2019
@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Mar 10, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-adonet-sqlite breaking-change closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants