Skip to content

Commit 5c58287

Browse files
committed
Fix trim annotations on generated validation code
1 parent 8491a27 commit 5c58287

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Emitters/ValidationsGenerator.Emitter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public GeneratedValidatablePropertyInfo(
6666
Name = name;
6767
}
6868
69+
[global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
6970
internal global::System.Type ContainingType { get; }
7071
internal string Name { get; }
7172
@@ -123,10 +124,11 @@ file static class GeneratedServiceCollectionExtensions
123124
{{GeneratedCodeAttribute}}
124125
file static class ValidationAttributeCache
125126
{
126-
private sealed record CacheKey(global::System.Type ContainingType, string PropertyName);
127+
private sealed record CacheKey([property: global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] global::System.Type ContainingType, string PropertyName);
127128
private static readonly global::System.Collections.Concurrent.ConcurrentDictionary<CacheKey, global::System.ComponentModel.DataAnnotations.ValidationAttribute[]> _cache = new();
128129
129130
public static global::System.ComponentModel.DataAnnotations.ValidationAttribute[] GetValidationAttributes(
131+
[global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
130132
global::System.Type containingType,
131133
string propertyName)
132134
{

0 commit comments

Comments
 (0)