-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
NativeAOTarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
AoT-enabled applications will get build warnings if the new validation support in .NET 10 Preview 3 is enabled.
AotValidation succeeded with 2 warning(s) (0.8s) → bin/Debug/net10.0/AotValidation.dll
/workspaces/AotValidation/Program.cs(48,16): warning IL2026: Using member 'System.ComponentModel.DataAnnotations.MaxLengthAttribute.MaxLengthAttribute(Int32)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Uses reflection to get the 'Count' property on types that don't implement ICollection. This 'Count' property may be trimmed. Ensure it is preserved.
/workspaces/AotValidation/obj/Debug/net10.0/Microsoft.AspNetCore.Http.ValidationsGenerator/Microsoft.AspNetCore.Http.ValidationsGenerator.ValidationsGenerator/ValidatableInfoResolver.g.cs(107,32): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'Microsoft.AspNetCore.Http.Validation.Generated.ValidationAttributeCache.CacheKey.ContainingType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
Expected Behavior
Validation support in Minimal APIs should be AOT compatible.
Steps To Reproduce
Minimal repro in this project:
https://github.com/mikekistler/AotValidation
Exceptions (if any)
No response
.NET Version
10.0.100-preview.3.25201.16
Anything else?
No response
Metadata
Metadata
Assignees
Labels
NativeAOTarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc