SendGrid works, but still throws exception not catchable in catch() block
Solution 1:
The method is awaitable:
public async Task<string> SendEmailSendGrid(...
Yet, the caller is not awaiting the result:
var result = utils.SendEmailSendGrid(decodedEmail, ...
Either await the result:
var result = await utils.SendEmailSendGrid(decodedEmail, ...
Or, if the invoking method is not an async
method:
var result = utils.SendEmailSendGrid(decodedEmail, ...).GetAwaiter().GetResult();
Visual Studio is not breaking inside of your try/catch b/c the exception is in the .NET framework by not awaiting the result. You should be able to resolve that by enabling "just my code" in the visual studio debugger settings (IIRC).