DapperLib / DapperLib/Dapper

while using QueryFirstOrDefaultAsync without Using block ,getting wrong result in output

Open
#1,740 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

While using QueryFirstOrDefaultAsync ,In a certain scenario where the outbound connection in Azure appservice is high , output of the query gives wrong result

Code Sample : var orderDetail = await connection.QueryFirstOrDefaultAsync(query).ConfigureAwait(true);

We are able to fix the issue after wrapping the code(connecting object) inside using block

using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools()))
{
var orderDetail = await connection.QueryFirstOrDefaultAsync(query).ConfigureAwait(true);
}

Not sure, how disposal of connection object helped to resolve the issue
Can any one help me to find the theory behind it?

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

Start by examining the connection lifetime around SqlConnection and QueryFirstOrDefaultAsync in the Azure App Service scenario. Reproduce the reported wrong result with and without the using block, recording the query and connection conditions described in the issue. Done means establishing a minimal reproducible case and clearly documenting the cause or required connection-lifetime behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, sql
Domain
backend, cloud, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.