I have a problem with the following code when T-SQL proc raises an error (SQLException)
var result = await conn.QueryMultipleAsync("Inventory.uspLoadItems", new
{
dbId = obj.myId,
},
commandType: CommandType.StoredProcedure);
var items = await result.ReadAsync();
var specificItems = MyCustomMapper.MapTo<MyItem>((dynamic)items);
I am using Dapper version 1.50.2.
The process translates into a subtle exception.
I can track the exception down to the WebApi controller method. But when the controller method exists, another (spawned and incomplete) thread continues to run in var items = await items.ReadAsync();, even if the WebApi session has ended (GC compiled?).(the text was deleted due to me misunderstanding of the information in the Parallell Stack window. The exception was not in ReadAsync, but not in QueryMultipleAsync and, therefore, did not continue after the exception). Looks like a threading issue in Dapper, but I'm not sure.
UPDATE
Microsoft Connect, , , .
https://connect.microsoft.com/VisualStudio/feedback/details/2592987/sqldatareader-nextresultasync-causes-unobserved-task-exception-even-when-awaited
, , . .NET.
Dapper, Dapper-contributers , :)
ReadAsync (), SqlDataReader.