Skip to content
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

Fix inconsistent signature of GetOptions method #4647

Merged
merged 2 commits into from
Nov 2, 2023

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Nov 1, 2023

Noticed this while working on samples. The new signature matches the API of Polly, has null as a default.

Microsoft Reviewers: Open in CodeFlow

@ghost ghost assigned martintmk Nov 1, 2023
@dotnet-comment-bot
Copy link
Collaborator

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Extensions.Telemetry 92 93
Microsoft.AspNetCore.Diagnostics.Middleware 99 100

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=457326&view=codecoverage-tab

@@ -59,7 +59,7 @@ internal ResilienceHandlerContext(AddResiliencePipelineContext<HttpKey> context)
/// <remarks>
/// If <paramref name="name"/> is <see langword="null"/> then the global options are returned.
/// </remarks>
public TOptions GetOptions<TOptions>(string name) => _context.GetOptions<TOptions>(name);
public TOptions GetOptions<TOptions>(string? name = null) => _context.GetOptions<TOptions>(name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add to the triple slash docs remarks section that if nothing gets passed then null will be used by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that implied by default null value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For people looking at the code, yes, but people looking at docs.microsoft.com where this info is surfaced that won't be the case. You can either add it on the remarks, or on the param section instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dotnet-comment-bot
Copy link
Collaborator

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.AspNetCore.Diagnostics.Middleware 99 100
Microsoft.Extensions.Telemetry 92 93

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=458490&view=codecoverage-tab

@joperezr joperezr merged commit 971b6f3 into release/8.0 Nov 2, 2023
6 checks passed
@joperezr joperezr deleted the mtomka/fix-inconsistent-signature branch November 2, 2023 17:01
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants