-
Notifications
You must be signed in to change notification settings - Fork 751
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
Address remaining trim warnings #4962
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Net.Http; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
@@ -118,8 +119,8 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt | |
var routingOptions = context.GetOptions<RequestRoutingOptions>(routingBuilder.Name); | ||
|
||
_ = builder | ||
.AddStrategy(_ => new RoutingResilienceStrategy(routingOptions.RoutingStrategyProvider), new EmptyResilienceStrategyOptions()) | ||
.AddStrategy(_ => new RequestMessageSnapshotStrategy(), new EmptyResilienceStrategyOptions()) | ||
.AddStrategy(_ => new RoutingResilienceStrategy(routingOptions.RoutingStrategyProvider)) | ||
.AddStrategy(_ => new RequestMessageSnapshotStrategy()) | ||
.AddTimeout(options.TotalRequestTimeout) | ||
.AddHedging(options.Hedging); | ||
}); | ||
|
@@ -142,6 +143,11 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt | |
return new StandardHedgingHandlerBuilder(builder.Name, builder.Services, routingBuilder); | ||
} | ||
|
||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", | ||
Justification = "The EmptyResilienceStrategyOptions doesn't have any properties to validate.")] | ||
private static ResiliencePipelineBuilder<HttpResponseMessage> AddStrategy(this ResiliencePipelineBuilder<HttpResponseMessage> builder, Func<StrategyBuilderContext, ResilienceStrategy> factory) => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @martintmk - do you think Polly could expose this API instead? That way callers wouldn't have to define an empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could. Could you create an issue in Polly repo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. App-vNext/Polly#1985 |
||
builder.AddStrategy(factory, new EmptyResilienceStrategyOptions()); | ||
|
||
private sealed record StandardHedgingHandlerBuilder( | ||
string Name, | ||
IServiceCollection Services, | ||
|
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.
🎉