{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-event-hubs-dotnet/issues/39","repository_url":"https://api.github.com/repos/Azure/azure-event-hubs-dotnet","labels_url":"https://api.github.com/repos/Azure/azure-event-hubs-dotnet/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-event-hubs-dotnet/issues/39/comments","events_url":"https://api.github.com/repos/Azure/azure-event-hubs-dotnet/issues/39/events","html_url":"https://github.com/Azure/azure-event-hubs-dotnet/issues/39","id":185300920,"number":39,"title":"Consider using .ConfigureAwait(false) throughout the code","user":{"login":"SeanFeldman","id":1309622,"avatar_url":"https://avatars.githubusercontent.com/u/1309622?v=3","gravatar_id":"","url":"https://api.github.com/users/SeanFeldman","html_url":"https://github.com/SeanFeldman","followers_url":"https://api.github.com/users/SeanFeldman/followers","following_url":"https://api.github.com/users/SeanFeldman/following{/other_user}","gists_url":"https://api.github.com/users/SeanFeldman/gists{/gist_id}","starred_url":"https://api.github.com/users/SeanFeldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeanFeldman/subscriptions","organizations_url":"https://api.github.com/users/SeanFeldman/orgs","repos_url":"https://api.github.com/users/SeanFeldman/repos","events_url":"https://api.github.com/users/SeanFeldman/events{/privacy}","received_events_url":"https://api.github.com/users/SeanFeldman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-10-26T05:31:52Z","updated_at":"2016-10-31T04:18:35Z","closed_at":null,"body":"## Description\n\nWhen awaiting for an async method, by default context is captured and attempted to be restored. Since this is a library, it could be used from UI or non-UI code. W/o specifying `.ConfigureAwait(false)` there will be some overhead of attempting to restore the context. To avoid that, awaited code should explicitly specifying not to restore the context.\n\n> ConfigureAwait provides a means to avoid the default SynchronizationContext capturing behavior; passing false for the flowContext parameter prevents the SynchronizationContext from being used to resume execution after the await.\n## Example\n\nBefore:\n\n``` c#\nawait this.SendLinkManager.GetOrCreateAsync(timeoutHelper.RemainingTime());\n```\n\nAfter:\n\n``` c#\nawait this.SendLinkManager.GetOrCreateAsync(timeoutHelper.RemainingTime()).ConfigureAwait(false);\n```\n"},"comment":{"url":"https://api.github.com/repos/Azure/azure-event-hubs-dotnet/issues/comments/257211061","html_url":"https://github.com/Azure/azure-event-hubs-dotnet/issues/39#issuecomment-257211061","issue_url":"https://api.github.com/repos/Azure/azure-event-hubs-dotnet/issues/39","id":257211061,"user":{"login":"SeanFeldman","id":1309622,"avatar_url":"https://avatars.githubusercontent.com/u/1309622?v=3","gravatar_id":"","url":"https://api.github.com/users/SeanFeldman","html_url":"https://github.com/SeanFeldman","followers_url":"https://api.github.com/users/SeanFeldman/followers","following_url":"https://api.github.com/users/SeanFeldman/following{/other_user}","gists_url":"https://api.github.com/users/SeanFeldman/gists{/gist_id}","starred_url":"https://api.github.com/users/SeanFeldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeanFeldman/subscriptions","organizations_url":"https://api.github.com/users/SeanFeldman/orgs","repos_url":"https://api.github.com/users/SeanFeldman/repos","events_url":"https://api.github.com/users/SeanFeldman/events{/privacy}","received_events_url":"https://api.github.com/users/SeanFeldman/received_events","type":"User","site_admin":false},"created_at":"2016-10-31T04:18:35Z","updated_at":"2016-10-31T04:18:35Z","body":"[Jeffrey Richter](https://www.wintellectnow.com/Videos/Watch/performing-i-o-bound-asynchronous-operations?videoId=performing-i-o-bound-asynchronous-operations#) on capturing synchronization context and marshaling it back _and_ library methods video. Quoting (time 1:26:02)\r\n\r\n> if you have a library method that has multiple `await`s in it, then you **must** apply `ConfigureAwait(false)` to every task that you await. You can't just do just a single one, you must have the **discipline** to apply it to every single one.\r\n"}}
{"actor":{"display_login":"SeanFeldman"}}