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

Use InterceptorsNamespaces feature name instead of InterceptorsPreviewNamespaces #74865

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

RikkiGibson
Copy link
Contributor

@RikkiGibson RikkiGibson commented Aug 22, 2024

Closes #74511

Here I am making an assumption that the build tasks and the associated compiler will be in sync. If that assumption is wrong, then this handling will probably have to be pushed into the command line layer (i.e. concat'ing /features:InterceptorsNamespaces=... and /features:InterceptorsPreviewNamespaces=....

@RikkiGibson RikkiGibson requested a review from a team as a code owner August 22, 2024 22:18
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 22, 2024
@@ -218,12 +218,14 @@ There is an experimental public API `GetInterceptorMethod(this SemanticModel, In

### User opt-in

To use interceptors, the user project must specify the property `<InterceptorsPreviewNamespaces>`. This is a list of namespaces which are allowed to contain interceptors.
To use interceptors, the user project must specify the property `<InterceptorsNamespaces>`. This is a list of namespaces which are allowed to contain interceptors.
Copy link
Member

Choose a reason for hiding this comment

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

InterceptorsNamespaces

Should the name be "InterceptorNamespaces" rather than "Interceptors..."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the issue there seemed to be agreement on the name InterceptorsNamespaces, i.e. the namespaces which contain interceptors. So I prefer to keep this name.

It's expected that each entry in the `InterceptorsPreviewNamespaces` list roughly corresponds to one source generator. Well-behaved components are expected to not insert interceptors into namespaces they do not own.
It's expected that each entry in the `InterceptorsNamespaces` list roughly corresponds to one source generator. Well-behaved components are expected to not insert interceptors into namespaces they do not own.

For compatibility, the property `<InterceptorsPreviewNamespaces>` can be used as an alias for `<InterceptorsNamespaces>`. If both properties have non-empty values, they will be concatenated together in the order `$(InterceptorsNamespaces);$(InterceptorsPreviewNamespaces)` when passed to the compiler.
Copy link
Member

@cston cston Aug 23, 2024

Choose a reason for hiding this comment

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

concatenated together

Will we avoid duplicate interceptors if the two properties have the same namespaces? (Is there a scenario where both properties are set identically, to handle different builds of the compiler?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that test GetInterceptorMethod_10 shows that we don't behave badly if the same namespace is included multiple times.

@RikkiGibson RikkiGibson requested a review from jaredpar August 23, 2024 00:42
@RikkiGibson
Copy link
Contributor Author

@jaredpar for review. Mainly I'm unsure about my assumption that compiler and build tasks will be in sync here. Is it possible for example that an older version of the build task would end up getting used to pass arguments to a newer compiler?

@RikkiGibson RikkiGibson requested a review from a team August 23, 2024 22:06
@jaredpar
Copy link
Member

Is it possible for example that an older version of the build task would end up getting used to pass arguments to a newer compiler?

Generally speaking no. The compiler and build task are always in sync.

The one exception is if the build parameters CscToolExe and CscToolPath are set. That allows customers to direct to a specific binary on disk that isn't necessarily tied to our deployment. That is very much a buyer beware territory and we don't concern ourselves with sync issues like this.

@RikkiGibson
Copy link
Contributor Author

@dotnet/roslyn-compiler for second review

@@ -218,12 +218,14 @@ There is an experimental public API `GetInterceptorMethod(this SemanticModel, In

### User opt-in

To use interceptors, the user project must specify the property `<InterceptorsPreviewNamespaces>`. This is a list of namespaces which are allowed to contain interceptors.
To use interceptors, the user project must specify the property `<InterceptorsNamespaces>`. This is a list of namespaces which are allowed to contain interceptors.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: it feels a bit inconsistent that the "Interceptors" part is plural, I would expect this to be named like InterceptorNamespaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interceptors still require InterceptorsPreviewNamespaces property
5 participants