Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing ConfigureAwait in TcpClientAdapter #897

Merged
merged 1 commit into from
Jul 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/client/impl/TcpClientAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public virtual async Task ConnectAsync(string host, int port)
throw new ArgumentException($"No ip address could be resolved for {host}");
}

await ConnectAsync(ep, port);
await ConnectAsync(ep, port).ConfigureAwait(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any difference in using ConfigureAwait(false) at the end of the method? After all, after this line there is no code and there is no next step of the state machine. Or am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no difference. Context capturing is applied to the continuation which is the end of the method. Though in general libs that don't need context capture should always opt out for every await. It would be best to even enable i.ex. Fxcop even if only https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2007?view=vs-2019 is activated

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. Also I use ca2007 in everyday work. I have to always disable its warnings for test projects.

}

public virtual async Task ConnectAsync(IPAddress ep, int port)
Expand Down