Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Queryasync skipped to next line without return anything

Open jmsiyath opened this issue 2 years ago • 2 comments

I face same issue in .net 4.8 and .net 5,6 and 7 also, whenever I use queryasync, queryfirstordefaultasync() ... Any async functions with or without await is not working. it just skip the line and hang total application forever. Not even return exception. Why and how can i overcome the issue, i use the latest version of dapper everytime when I tried.

All same queries without async working fine.

jmsiyath avatar Aug 29 '23 15:08 jmsiyath

Off the top of my head there are two possible ways this could happen:

  • sync context deadlock if we've missed a ConfigureAwait
  • a dropped TCS in a provider

We can investigate, but some clues on how to repro would help; is there a sync-context here? I.e. is SynchronizationContext.Current non-null? And what database provider are you using?

mgravell avatar Aug 29 '23 16:08 mgravell

Oh, and example code that shows exactly what method you're using, so I can check for a missing ConfigureAwait

mgravell avatar Aug 29 '23 16:08 mgravell