Skip to content

fix: dispose command when DbWrappedReader.DisposeAsync is called#2206

Open
leno23 wants to merge 1 commit into
DapperLib:mainfrom
leno23:fix/dbwrappedreader-dispose-async-2185
Open

fix: dispose command when DbWrappedReader.DisposeAsync is called#2206
leno23 wants to merge 1 commit into
DapperLib:mainfrom
leno23:fix/dbwrappedreader-dispose-async-2185

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • DbWrappedReader.DisposeAsync now disposes the wrapped IDbCommand after the reader, matching synchronous Dispose behavior.

Motivation

Fixes #2185async using with ExecuteReaderAsync left the command undisposed because only the reader was disposed asynchronously.

Test plan

  • DbWrappedReader_DisposeAsync_DisposesCommand unit test added
  • dotnet test tests/Dapper.Tests/Dapper.Tests.csproj --filter WrappedReaderTests

Made with Cursor

Mirror synchronous Dispose behavior so async using with
ExecuteReaderAsync releases the underlying IDbCommand.

Fixes DapperLib#2185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command not disposed with async using and ExecuteReaderAsync

1 participant