-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Upgrade analyzer version to 0.1.1-dev.20230613.1 #37037
Conversation
Pull request contains merge conflicts. |
…o updateAnalyzer
/azp run net - compute - mgmt |
Azure Pipelines successfully started running 1 pipeline(s). |
sdk/resourcemanager/Azure.ResourceManager/src/GlobalSuppressions.cs
Outdated
Show resolved
Hide resolved
sdk/storage/Azure.Storage.Files.DataLake/src/GlobalSuppressions.cs
Outdated
Show resolved
Hide resolved
sdk/storage/Azure.Storage.Files.Shares/src/GlobalSuppressions.cs
Outdated
Show resolved
Hide resolved
public virtual AsyncPageable<AssetConversion> GetConversionsAync(CancellationToken cancellationToken = default) | ||
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods. | ||
{ |
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.
There is a typo here GetConversionsAync
should be GetConversionsAsync
. Therefore these two async/sync pair cannot find each other. I have to suppress here. This library is GAed.
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.
Thank you for finding this! It might be helpful to file an issue for this library to let them know - they could introduce a correctly-spelled method and mark the misspelled one with "EditorBrowsableState.Never"
@@ -811,7 +815,7 @@ private void SetNameFieldsIfNull() | |||
/// </remarks> | |||
[EditorBrowsable(EditorBrowsableState.Never)] | |||
public virtual async Task<Response<BlobDownloadInfo>> DownloadAsync( | |||
CancellationToken cancellationToken) => | |||
CancellationToken cancellationToken = default) => | |||
await DownloadAsync( |
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.
It's corresponding sync method Download
has optional CancellationToken
.
@@ -1875,7 +1883,7 @@ private void SetNameFieldsIfNull() | |||
/// </list> | |||
/// </remarks> | |||
public virtual async Task<Response<BlobDownloadResult>> DownloadContentAsync( | |||
CancellationToken cancellationToken) => | |||
CancellationToken cancellationToken = default) => |
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.
It's corresponding sync method DownloadContent
has optional cancellationToken.
public virtual async Task<Response<bool>> GroupExistsAsync(string group, RequestContext context = default) | ||
#pragma warning restore AZC0018 // Protocol method should take a RequestContext parameter called `context` and not use a model as parameter or return types. | ||
{ |
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.
I don't know why there is a RequestContext
and a Response<bool>
. But this one is GAed. I have to suppress.
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.
I think we allow this one for HEAD requests -- it would be worth checking the generator code to confirm my memory that this is what the generator will write in all cases for a HEAD request . It might make sense to update the PR for this so it doesn't confuse client authors in the future, but I'm happy for us to track this as future work in a separate issue.
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.
Yes, you are correct. I fixed in this PR.
…o updateAnalyzer
@@ -2316,7 +2328,9 @@ private void SetNameFieldsIfNull() | |||
/// A <see cref="RequestFailedException"/> will be thrown if | |||
/// a failure occurs. | |||
/// </remarks> | |||
#pragma warning disable AZC0002 // Client method should have an optional CancellationToken (both name and it being optional matters) or a RequestContext as the last parameter. |
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.
I am happy to see these being added in line, rather than in a GlobalSuppressions file, because it means the analyzer will still catch issues in the future. Out of curiosity, what has changed in the analyzer for AZC0002 that made it start catching these where it didn't before? For these overloads that call through to a method that takes a cancellation token, could we identify those in the analyzer? I think the goal of the analyzer is to ensure that there is an overload that takes a cancellation token in the public API.
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.
Yeah, I changed the logic to look for overloads. Then the suppression could be removed.
@@ -2355,9 +2371,11 @@ private void SetNameFieldsIfNull() | |||
/// A <see cref="RequestFailedException"/> will be thrown if | |||
/// a failure occurs. | |||
/// </remarks> | |||
#pragma warning disable AZC0002 // Client method should have an optional CancellationToken (both name and it being optional matters) or a RequestContext as the last parameter. |
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.
Would it be possible to make this cancellationToken optional, or would that be a breaking change?
Why must the cancellationToken be optional if there is an overload that doesn't take one?
@@ -2799,7 +2799,9 @@ public new DataLakeFileClient WithCustomerProvidedKey(Models.DataLakeCustomerPro | |||
/// A <see cref="RequestFailedException"/> will be thrown if | |||
/// a failure occurs. | |||
/// </remarks> | |||
#pragma warning disable AZC0002 // Client method should have an optional CancellationToken (both name and it being optional matters) or a RequestContext as the last parameter. |
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.
These look like valid exemptions - do we know why the analyzer didn't catch this one before?
@@ -10,7 +10,7 @@ public partial class ChatClient | |||
protected ChatClient() { } | |||
public ChatClient(System.Uri endpoint, Azure.Communication.CommunicationTokenCredential communicationTokenCredential, Azure.Communication.Chat.ChatClientOptions options = null) { } | |||
public virtual Azure.Response<Azure.Communication.Chat.CreateChatThreadResult> CreateChatThread(string topic, System.Collections.Generic.IEnumerable<Azure.Communication.Chat.ChatParticipant> participants, string idempotencyToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | |||
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Chat.CreateChatThreadResult>> CreateChatThreadAsync(string topic, System.Collections.Generic.IEnumerable<Azure.Communication.Chat.ChatParticipant> participants = null, string idempotencyToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } | |||
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Chat.CreateChatThreadResult>> CreateChatThreadAsync(string topic, System.Collections.Generic.IEnumerable<Azure.Communication.Chat.ChatParticipant> participants, string idempotencyToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } |
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.
Is this a breaking change to a GA library?
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.
I think it is OK. See #37037 (comment)
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.
@tg-msft, can you confirm this is an acceptable change?
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.
Given that we're effectively replacing a runtime NullRefEx with a compile time break per https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/communication/Azure.Communication.Chat/src/ChatClient.cs#L59-L95, I think we should take this.
+@glorialimicrosoft as an FYI of the change and that we might also want an Argument.AssertNotNull(participants, nameof(participants))
here (which isn't considered breaking to add either).
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.
LGTM for my owned files now
…o updateAnalyzer
Hi @pshao25. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
See changes at Azure/azure-sdk-tools#6496 (comment)