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

Add AsyncPageable scope validation #17635

Merged
14 commits merged into from
Dec 18, 2020

Conversation

pakrym
Copy link
Contributor

@pakrym pakrym commented Dec 17, 2020

Fixes: #17633

@@ -705,7 +705,7 @@ private Request CreateGetRequest(string key, string label, DateTimeOffset accept
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
private async Task<Page<ConfigurationSetting>> GetConfigurationSettingsPageAsync(SettingSelector selector, string pageLink, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ConfigurationClient)}.{nameof(GetConfigurationSettingsPage)}");
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ConfigurationClient)}.{nameof(GetConfigurationSettings)}");
Copy link
Member

Choose a reason for hiding this comment

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

Will these changes be a problem for existing customers given that this is a GA library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm reluctant to treat this as a breaking change. The scenarios where this would break anyone are pretty theoretical.

…able-scope-validation

# Conflicts:
#	eng/Packages.Data.props
@ghost
Copy link

ghost commented Dec 17, 2020

Hello @pakrym!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@pakrym pakrym requested a review from schaabs as a code owner December 18, 2020 00:14
@ghost ghost merged commit 4f191fb into Azure:master Dec 18, 2020
bool strict = !invocation.Method.GetCustomAttributes(true).Any(a => a.GetType().FullName == "Azure.Core.ForwardsClientCallsAttribute");
if (invocation.Method.ReturnType.Name.Contains("Pageable") ||
invocation.Method.ReturnType.Name.Contains("IAsyncEnumerable"))
if (invocation.Method.ReturnType is {IsGenericType: true} genericType &&
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we add the validator for Pageable in addition to AsyncPageable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This validator runs before we forward calls from async->sync so everything would look sync to it.

annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this pull request Feb 17, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TestFramework] Validate AsyncPageable diagnostic scopes
2 participants