Skip to content

Refactored use of async.#215

Merged
WilliamsJason merged 3 commits into
microsoft:masterfrom
dotMorten:Await
Feb 15, 2017
Merged

Refactored use of async.#215
WilliamsJason merged 3 commits into
microsoft:masterfrom
dotMorten:Await

Conversation

@dotMorten
Copy link
Copy Markdown
Contributor

No tight while-loops but instead using await and continue on background threads.

Addresses #214

@WilliamsJason

@msftclas
Copy link
Copy Markdown

Hi @dotMorten, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

if (!response.IsSuccessStatusCode)
{
throw new DevicePortalException(response);
throw await DevicePortalException.CreateAsync(response);
Copy link
Copy Markdown
Contributor Author

@dotMorten dotMorten Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't have async code in a constructor, so I changed the exception creation to be a static async creator (see further down), and changed all uses of it to this instead.

@dotMorten
Copy link
Copy Markdown
Contributor Author

Hold off on review... I just saw a lot of use of .Wait(). That's also a big no-no and causes deadlocks. Will update PR...

…onfigureAwait, and remove await where not needed
…tch to ui thread, it's easier to just await and continue on the same thread here.
@dotMorten
Copy link
Copy Markdown
Contributor Author

ok ready for review @WilliamsJason

Copy link
Copy Markdown
Contributor

@WilliamsJason WilliamsJason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff, thanks!

@WilliamsJason WilliamsJason merged commit 83d12b2 into microsoft:master Feb 15, 2017
@dotMorten dotMorten deleted the Await branch February 15, 2017 20:07
dotMorten added a commit to dotMorten/WindowsDevicePortalWrapper that referenced this pull request Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants