Skip to content

ConfigureAwait() call when sending mail using new API #362

@steve-tapley

Description

@steve-tapley

Hi,

I'm migrating my code from v6 to v8.

Previously, I would send an email like this:
var transportWeb = new Web(SendGridApiKey); await transportWeb.DeliverAsync(emailMessage).ConfigureAwait(false);
With v8, I am required to do something like this:
var mailClient = new SendGridAPIClient(SendGridApiKey); dynamic response = await mailClient.client.mail.send.post(requestBody: mail.Get());

The code is missing ConfigureAwait(false) - and as far as I am aware, this is required for proper async handling.

Due to the dynamic nature of the API, i can add it, but this results in an exception with the message:
'System.Runtime.CompilerServices.ConfiguredTaskAwaitable<SendGrid.CSharp.HTTP.Client.Response>'

So, how can I add ConfigureAwait(false) to make this follow the async guidelines?

Thanks,
Steve

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wantedrequesting help from the communitytype: questionquestion directed at the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions