DapperLib / DapperLib/Dapper

Dapper - reader.IsConsumed is false even after reading the last resultset

Open
#469 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

I am using Dapper version 1.42.0 and SQL Server as the back end to read multiple result-set by executing a Stored Procedure. The issue is that the IsConsumed property of the reader object is false when the last result-set uses spiltOn option to create multiple objects.

This isn't an issue most of the time as this occurs on the result-set, but in my case I have three result sets in which the last set is optional and the 2nd set uses splitOn option to create multiple objects. I use the reader.IsConsumed to determine whether to Read the last result-set or not and in cases when the stored procedure returns only 2 sets I receive an ObjectDisposed error when the code proceeds to read the 3rd set

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with Dapper 1.42.0, SQL Server, and a stored procedure returning three result sets, with splitOn used in the second set and the third set optional. Start from the multi-result reader and IsConsumed behavior; done means the final result set is recognized correctly and an absent optional set does not cause ObjectDisposed when read.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.