I have the following async method in a C# controller. If I misspell a parameter name or mismatch a data type, an error is thrown and caught as expected. If the error is thrown inside the procedure itself, it never seems to bubble up back to the controller like it does in a non async controller. In this case, the procedure is expecting a comma delimed string in the school IDs, but my toString method doesn’t actually produce that.
See images below of stepping into code/error.
Note: this is a re-post. My first one lacked clarity apparently.
[HttpPost]
public async Task<JsonResult> InsertInviteSchedule(ConsolidatedInviteSchedule ConsolidatedInviteSchedule)
{
string schoolASIDs = ConsolidatedInviteSchedule.SchoolASID.ToString();
//string schoolASIDs = string.Join(",", ConsolidatedInviteSchedule.SchoolASID);
using (var sqlConn = Authentication.SurveyVoP())
{
try
{
await sqlConn.ExecuteAsync(
"SurveyVoP.InviteSchedule_Insert",
param: new
{
ConsolidatedInviteSchedule.SurveyID,
SchoolASIDs = schoolASIDs,
ConsolidatedInviteSchedule.OpenWindowDate,
ConsolidatedInviteSchedule.CloseWindowDate,
EmployeeCode = ConsolidatedInviteSchedule.CreatedByEmployeeCode
},
commandType: CommandType.StoredProcedure);
return Json(new { success = true });
} catch (Exception ex)
{
throw ex;
}
}
}