Skip to content

Conversation

@martincostello
Copy link
Member

@martincostello martincostello commented Jan 28, 2022

Use non-generic TaskCompletionSource

Use the non-generic TaskCompletionSource where appropriate.

Description

Inspired by dotnet/runtime#64423, I had a look to see if there were any usages of TaskCompletionSource<T> that could just use the non generic variant instead. Searching for bool, int and object I found quite a few, mostly in tests, which were just being used to signal completion of arbitrary operation where the T value wasn't used.

This PR changes all such usages that wouldn't require use of conditional compilation to handle TFMs that don't have support for TaskCompletionSource.

I've left this as a draft for now because it touches a lot of files so it doesn't create a notification deluge. If this change isn't welcome (or is too big), I can just close it (or amend it).

Use the non-generic TaskCompletionSource where appropriate.
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jan 28, 2022
@BrennanConroy
Copy link
Member

General note: Mass modifying test code for something like this isn't generally interesting or useful. If there is product code that could be updated that is useful (and I see there are a couple in this PR).

@martincostello
Copy link
Member Author

@BrennanConroy Noted for future reference 👍 - shall I trim this down just to the product code updates?

@Pilchie Pilchie added area-blazor Includes: Blazor, Razor Components area-runtime area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-signalr Includes: SignalR clients and servers labels Jan 28, 2022
@pranavkm pranavkm marked this pull request as ready for review January 29, 2022 00:32
@pranavkm pranavkm merged commit 123d9b5 into dotnet:main Jan 29, 2022
@ghost ghost added this to the 7.0-preview1 milestone Jan 29, 2022
@martincostello martincostello deleted the Use-TaskCompletionSource branch January 29, 2022 07:26
@wtgodbe wtgodbe modified the milestones: 7.0-preview1, 7.0-preview2 Jan 31, 2022
@amcasey amcasey added area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions area-signalr Includes: SignalR clients and servers community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants