Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

QueryAsync sometimes returns data for a different request than the current one

Aperta
#2,159 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp, sql
Ambito
backend, database

Direzione di ricerca

Il report nomina QueryAsync e mostra il sito di chiamata ASP.NET, ma non identifica alcun file sorgente di Dapper né alcun test non riuscito. Inizia riproducendo il comportamento con chiamate concorrenti che usano parametri distinti, quindi segui QueryAsync attraverso la materializzazione dei risultati e la gestione dei parametri di output. Il lavoro è completato quando la causa è stata isolata e catturata in un test di regressione che mantiene separati i risultati di ogni richiesta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug needs-triage

I have an application in ASP.NET MVC + ASP.NET API (.NET 9, OS Windows Server 2022, MS SQL 2022), where I use the Dapper library (2.1.66) to call stored procedures (other queries are handled by EF 9.0.4).

Recently, I noticed that with a high volume of requests to call the same procedure but with different parameters, sometimes I receive data from the result of a different request's execution. It seems that both the SQL and C# code are correct. Additionally, I have been monitoring the database queries and intentionally added an OUTPUT parameter (FakeParameter) with a random GUID to make sure this is not a SQL code issue. Importantly, this error occurs occasionally for different input parameters, with no apparent pattern, except that both requests need to come almost simultaneously. In such cases, Request 1 will receive its correct data in response, but Request 2 will receive the same data as Request 1 instead of its own separate data.

Below are code examples:

List<SP_Result> data = null;
var args = new DynamicParameters(new
{
AccountId = model.AccountId,
SortField = model.OrderColumnNo,
SortDirection = model.OrderDirection,
});
args.Add("RecordsTotal", dbType: DbType.Int32, direction: ParameterDirection.Output);
args.Add("FakeParam", dbType: DbType.Guid, direction: ParameterDirection.Output);

using (var con = new SqlConnection(DBContext.Database.GetConnectionString()))
{
data = (await con.QueryAsync<SP_Result>("SPName",
args, commandType: CommandType.StoredProcedure)).ToList();
}

I am certain (through logging data to the logs) that the GUID value in FakeParam for Request 2 matches what was returned by the stored procedure call for the same request, but after calling ToList, the data returned is from Request 1.

Lingua principale
C#
Stelle
18.4k
Fork
3.7k
Merge medio
2g 5h
PR unite (30g)
4

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DapperLib/Dapper

Tutte le issue di DapperLib/Dapper

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.