Skip to content

Interceptors still require InterceptorsPreviewNamespaces property #74511

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

Closed
captainsafia opened this issue Jul 23, 2024 · 1 comment · Fixed by #74865
Closed

Interceptors still require InterceptorsPreviewNamespaces property #74511

captainsafia opened this issue Jul 23, 2024 · 1 comment · Fixed by #74865
Assignees
Labels
Area-Compilers blocking API needs to reviewed with priority to unblock work
Milestone

Comments

@captainsafia
Copy link
Member

The compiler will emit a warning for source generators that use interceptors about the need for an InterceptorsPreviewNamespaces property in the target project.

/Users/captainsafia/git/aspnetcore/openapi-fixes/artifacts/obj/Microsoft.AspNetCore.OpenApi/Debug/net9.0/Microsoft.AspNetCore.Http.RequestDelegateGenerator/Microsoft.AspNetCore.Http.RequestDelegateGenerator.RequestDelegateGenerator/GeneratedRouteBuilderExtensions.g.cs(61,10): error CS9137: The 'interceptors' experimental feature is not enabled in this namespace. Add '<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.AspNetCore.Http.Generated</InterceptorsPreviewNamespaces>' to your project.

cc: @jaredpar @RikkiGibson

@ghost ghost added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 23, 2024
@jaredpar jaredpar added blocking API needs to reviewed with priority to unblock work and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 23, 2024
@jaredpar jaredpar added this to the 17.12 milestone Jul 23, 2024
@RikkiGibson
Copy link
Member

My expectation here is that we would introduce an InterceptorsNamespaces property which is basically just an alias for InterceptorsPreviewNamespaces, at least in the medium term.

The reason is that this simplifies "discovery" of [InterceptsLocation] attributes which has to occur when public APIs like SemanticModel.GetInterceptorMethod(InvocationExpressionSyntax) are used.

Essentially until we make the engineering investment to make discovery more performant for editor scenarios it feels like we should continue to require this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers blocking API needs to reviewed with priority to unblock work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants