-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Investigate native AOT compatibility #1110
Comments
Currently, as far as I know the https://github.com/App-vNext/Polly/blob/main/src/Polly.Core/Utils/ValidationHelper.cs However, .NET folks are planning to introduce a generator for options validation: This can help us make Polly V8 reflection-free. The only downside is that the generator works with cc @geeknoid |
The .NET 8 generator currently depends on Microsoft.Extensions.Options. This is because the geneator looks at the IValidateOptions type to determine the type to implement validation for. Do you have any ideas how the generator could work without taking a dependency on Microsoft.Extensions.Options? |
@geeknoid Just thinking out loud. We could use this syntax: [OptionsValidator]
public partial class RetryStrategyOptions
{
// Can generate inner RetryStrategyOptionsValidator here
}
internal static partial class PollyValidators
{
// just implements the method
[OptionsValidator]
public static partial IEnumerable<ValidationResult> ValidateRetryOptions(RetryStrategyOptions options);
} Essentially, we just need something that we pass the options instance to and it returns us the list of That way, the Polly stays dependency free on .NET3.1+ runtimes. |
@martintmk I like those ideas. Not sure if I'll have time to put that in, but I'll try... |
Is your feature request related to a specific problem? Or an existing feature? Please describe.
ASP.NET Core 8 is making investments in supporting native AOT scenarios. In the case of APIs using Polly, we should ensure that we are also native AOT-friendly.
Describe your proposed or preferred solution:
Polly is fully usable with native AOT (or with known, documented, limitations).
Potential changes we may have to make include:
Describe any alternative options you've considered:
Do nothing.
Any additional info?
ASP.NET Core blog post
The text was updated successfully, but these errors were encountered: