8000 Set interceptors property for validations source generator by captainsafia · Pull Request #48891 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

Set interceptors property for validations source generator #48891

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

8000
Merged
merged 4 commits into from
May 12, 2025

Conversation

captainsafia
Copy link
Member

@Copilot Copilot AI review requested due to automatic review settings May 9, 2025 17:33
@captainsafia captainsafia requested a review from vijayrkn as a code owner May 9, 2025 17:33
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the validation source generator configuration by switching the interceptors property name and adding tests to validate the generator activation based on the target framework.

  • Renames the interceptors property from InterceptorsPreviewNamespaces to InterceptorsNamespaces.
  • Introduces a new test verifying validations generator support for .NET 10 and above.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs Adds tests for validations generator and adjusts interceptors property name.
src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets Updates property names and adds configuration for the validations generator.
Comments suppressed due to low confidence (1)

test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs:88

  • There is a naming inconsistency between the validations generator DLL ('Microsoft.AspNetCore.Http.ValidationsGenerator.dll') used in VerifyValidationsGeneratorIsUsed and the expected interceptor namespace ('Microsoft.AspNetCore.Http.Validation.Generated'). Consider aligning these names for clarity.
VerifyInterceptorsFeatureProperties(asset, expectEnabled, "Microsoft.AspNetCore.Http.Validation.Generated");

Copy link
@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@@ -68,6 +68,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<InterceptorsPreviewNamespaces Condition="'$(EnableRequestDelegateGenerator)' == 'true'">$(InterceptorsPreviewNamespaces);Microsoft.AspNetCore.Http.Generated</InterceptorsPreviewNamespaces>
<!-- Set the namespaces emitted by the ConfigurationBindingGenerator for interception when applicable. -->
<InterceptorsPreviewNamespaces Condition="'$(EnableConfigurationBindingGenerator)' == 'true'">$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces>
<!-- Set the namespaces emitted by the ValidationsGenerator for interception when applicable (.NET 10 and above). -->
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I could've sworn we ran into issues with the intrinsic functions that motivated us to use the default comparers but I can't track down the issue.

Actually, I tracked it down. The issue was with the IsTargetFrameworkCompatible function not the version number ones.

@captainsafia captainsafia enabled auto-merge (squash) May 12, 2025 19:20
@captainsafia captainsafia merged commit 6e5ee83 into main May 12, 2025
30 checks passed
@captainsafia captainsafia deleted the cs/validations-interceptor branch May 12, 2025 21:32
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.

Some projects need to add <InterceptorsNamespaces> with the latest aspnet builds
4 participants
0