-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
There was a problem hiding this 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");
src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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). --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to use VersionGreaterThanOrEquals
instead?
https://learn.microsoft.com/en-us/visualstudio/msbuild/property-functions?view=vs-2022#msbuild-version-comparison-functions
There was a problem hiding this comment.
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.
Closes dotnet/aspnetcore#61177.