Task.IsFaulted
is not capturing exception. It seems that IsFault
is not working. It is sending to else block even the condition is false. Can you plea
Instead of using IsFaulted
, just use try
/catch
:
try
{
await _emailSender.SendEmailAsync(contentRootPath, email, subject, comment, userid, fullname);
return @"
MCP Feedback Facility
Feedback submitted successfully.
";
}
catch
{
return @"
MCP Feedback Facility
Sorry, your feedback submission was not completed successfully
";
}
Side note: return await Task.FromResult