Skip to content

Allow tag helper discovery to be cancellable#12258

Merged
DustinCampbell merged 6 commits intodotnet:mainfrom
DustinCampbell:cancellation
Sep 24, 2025
Merged

Allow tag helper discovery to be cancellable#12258
DustinCampbell merged 6 commits intodotnet:mainfrom
DustinCampbell:cancellation

Conversation

@DustinCampbell
Copy link
Member

@DustinCampbell DustinCampbell commented Sep 23, 2025

This change threads cancellation through tag helper discovery and ensures that CancellationTokens are passed when it's called.


CI Build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2800220&view=results
Test Insertion: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/673094
Toolset Run: https://dev.azure.com/dnceng/internal/_build/results?buildId=2800222&view=results

- Add CancellationToken parameter to ITagHelperDescriptorProvider.Execute(...)
- Add CancellationToken parameter to ITagHelperFeature.GetDescriptors(...)
We can be less permissive and ensure that the optional "target" symbol passed passed into tag helper discovery is an IAssemblySymbol.
Most of the ITagHelperDescriptorProvider implementations create a Roslyn SymbolVisitor to find candidate types to create TagHelperDescriptors from. This process can be generalized to avoid the SymbolVisitor altogether.
@DustinCampbell DustinCampbell requested a review from a team as a code owner September 23, 2025 18:47
}

tagHelpers = tagHelperFeature.GetDescriptors();
tagHelpers = tagHelperFeature.GetDescriptors(cancellationToken);
Copy link
Contributor

Choose a reason for hiding this comment

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

cancellationToken

It feels like the DirectiveVisitor.Visit calls below should route the cancellation token through too

Copy link
Member Author

@DustinCampbell DustinCampbell Sep 23, 2025

Choose a reason for hiding this comment

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

That'll be a later change. I'm not trying to thread CancellationTokens through all phases yet. Besides, the source generator doesn't pass a token when executing individual phases yet, so that'll need to be done at the same time for it to help.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

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.

4 participants