Skip to content

Conversation

@halter73
Copy link
Member

.ConfigureAwait(false) in SignalR client libraries

  • Enable CA2007 (Consider calling ConfigureAwait on the awaited task) for SignalR client libraries and shared libraries
  • Don't use ForceAsync() in ignalR client libraries and shared libraries
    • The previous use of ForceAsync() could still cause deadlocks of the code using the client tried to block a UI thread (or any one-at-a-time SynchronizationContext) because internal SignalR logic would try to post back to it.

Fixes #39626
Partially addresses #31132

Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

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

👍🏽 We should also consider enabling this for things that aren't exclusively ASP.NET Core (e.g. DataProtection, Extensions.Features, JSInterop etc).


[Theory]
[MemberData(nameof(TransportTypes))]
public async Task CanBlockOnAsyncOperationsWithOneAtATimeSynchronizationContext(HttpTransportType transportType)
Copy link
Member

Choose a reason for hiding this comment

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

I thought we had tests like this before, but looks like they never got merged 😮
aspnet/SignalR#792

@davidfowl
Copy link
Member

Why are we using ConfigureAwait on the server side?

@Pilchie Pilchie added the area-signalr Includes: SignalR clients and servers label Jan 24, 2022
@halter73
Copy link
Member Author

Why are we using ConfigureAwait on the server side?

Fixed.

@halter73 halter73 merged commit 98bb246 into main Jan 25, 2022
@halter73 halter73 deleted the halter73/39626 branch January 25, 2022 20:54
@ghost ghost added this to the 7.0-preview1 milestone Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-signalr Includes: SignalR clients and servers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SignalR C# Client StartAsync() CancellationToken not respected

6 participants