dotnet / dotnet/aspnetcore

Ensure that all ValidationAttributes are native AoT compatible

Open
#61,221 2 comments 1 reaction 0 assignees View on GitHub
area-minimal feature-validation NativeAOT
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

Not all `ValidationAttributes` exposed by System.ComponentModel are native AoT compatible. Some use unbounded reflection to determine types and availalbe APIs on them.

We should make an effort to ensure that all non-native Aot compatible ValidationAttributes are consumed safely in the validation implementation.

- `RangeAttribute`: Can be achieved by introducing a new generic overload of the attribute that also supports being able to set `MinValue` and `MaxValue` independently
- `MaxLengthAttribute`: Uses reflection to get `Count` property. Might require source generation.
- Others?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.