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

Upgrade analyzer version to 0.1.1-dev.20230613.1 #37037

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c5ca5b0
Upgrade analyzer version to 0.1.1-dev.20230613.1
pshao25 Jun 15, 2023
81d6a5d
Update
pshao25 Jun 15, 2023
2a88ad2
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Jul 7, 2023
e1215ed
Update
pshao25 Jul 12, 2023
bf4450e
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Jul 17, 2023
0adff3b
Update
pshao25 Jul 17, 2023
c07d7d1
Update
pshao25 Jul 17, 2023
b0bef5e
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Jul 17, 2023
56d9071
Update
pshao25 Jul 17, 2023
08b896f
Update
pshao25 Jul 18, 2023
90a0baf
Update
pshao25 Jul 18, 2023
4df596e
Update
pshao25 Jul 25, 2023
db0cdb7
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Jul 25, 2023
eada748
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Jul 27, 2023
6e97987
update
pshao25 Jul 27, 2023
20913a8
update
pshao25 Jul 27, 2023
ced9931
Update
pshao25 Jul 27, 2023
42ebc54
Update
pshao25 Jul 27, 2023
23cd6ba
update
pshao25 Jul 27, 2023
5a158ef
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Jul 31, 2023
4a39793
update
pshao25 Aug 2, 2023
d1754a8
Update
pshao25 Aug 2, 2023
07da049
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Aug 2, 2023
4b1c9dc
Update
pshao25 Aug 3, 2023
99e18d5
Update
pshao25 Aug 3, 2023
e43eb1d
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Aug 3, 2023
0b4746d
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-net int…
pshao25 Aug 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
-->
<ItemGroup>
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20230725.1" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20230131.1" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20230726.2" PrivateAssets="All" />
<PackageReference Update="coverlet.collector" Version="3.2.0" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.2" PrivateAssets="All" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Usage", "AZC0007: A client type should have a public constructor with equivalent parameters that doesn't take a Azure.Core.ClientOptions-derived type as the last argument", Justification = "")]
[assembly: SuppressMessage("Usage", "AZC0006: A client type should have a public constructor with equivalent parameters that takes a Azure.Core.ClientOptions-derived type as the last argument", Justification = "")]
[assembly: SuppressMessage("Usage", "AZC0002: Client method should have cancellationToken as the last optional parameter (both name and it being optional matters", Justification = "")]
[assembly: SuppressMessage("Usage", "AZC0006: A client type should have a public constructor with equivalent parameters that takes a Azure.Core.ClientOptions-derived type as the last argument", Justification = "")]
annelo-msft marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,9 @@ private Response ToCreateResponse(string key, string label, MatchConditions requ
/// Adds an external synchronization token to ensure service requests receive up-to-date values.
/// </summary>
/// <param name="token">The synchronization token value.</param>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual void UpdateSyncToken(string token)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
Argument.AssertNotNull(token, nameof(token));
_syncTokenPolicy.AddToken(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,9 @@ private static MediaStreamingOptionsInternal CreateMediaStreamingOptionsInternal

/// <summary> Initializes a new instance of CallConnection. <see cref="CallConnection"/>.</summary>
/// <param name="callConnectionId"> The call connection id for the GetCallConnection instance. </param>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual CallConnection GetCallConnection(string callConnectionId)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(GetCallConnection)}");
scope.Start();
Expand All @@ -706,7 +708,9 @@ public virtual CallConnection GetCallConnection(string callConnectionId)
}

/// <summary> Initializes a new instance of GetCallRecording. <see cref="CallRecording"/>.</summary>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual CallRecording GetCallRecording()
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(GetCallRecording)}");
scope.Start();
Expand All @@ -722,7 +726,9 @@ public virtual CallRecording GetCallRecording()
}

/// <summary>Get Call Automation's EventProcessor for handling Call Automation's event more easily.</summary>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual CallAutomationEventProcessor GetEventProcessor()
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(GetEventProcessor)}");
scope.Start();
Expand All @@ -741,7 +747,9 @@ public virtual CallAutomationEventProcessor GetEventProcessor()
/// Get source identity used by Call Automation client.
/// </summary>
/// <returns></returns>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual CommunicationUserIdentifier GetSourceIdentity()
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(GetSourceIdentity)}");
scope.Start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ private static MediaStreamingOptionsInternal CreateMediaStreamingOptionsInternal

/// <summary> Initializes a new instance of CallConnection. <see cref="CallConnection"/>.</summary>
/// <param name="callConnectionId"> The call connection id for the GetCallConnection instance. </param>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual CallConnection GetCallConnection(string callConnectionId)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(GetCallConnection)}");
scope.Start();
Expand All @@ -446,7 +448,9 @@ public virtual CallConnection GetCallConnection(string callConnectionId)
}

/// <summary> Initializes a new instance of GetCallRecording. <see cref="CallRecording"/>.</summary>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual CallRecording GetCallRecording()
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(GetCallRecording)}");
scope.Start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Copy link
Member

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?

Copy link
Member Author

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)

Copy link
Member

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?

Copy link
Member

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).

public virtual Azure.Response DeleteChatThread(string threadId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteChatThreadAsync(string threadId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Communication.Chat.ChatThreadClient GetChatThreadClient(string threadId) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected ChatClient()
/// <param name="idempotencyToken"> If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-ID and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-ID is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. </param>
/// <param name="cancellationToken">The cancellation token for the task.</param>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
public virtual async Task<Response<CreateChatThreadResult>> CreateChatThreadAsync(string topic, IEnumerable<ChatParticipant> participants = null, string idempotencyToken = null, CancellationToken cancellationToken = default)
public virtual async Task<Response<CreateChatThreadResult>> CreateChatThreadAsync(string topic, IEnumerable<ChatParticipant> participants, string idempotencyToken = null, CancellationToken cancellationToken = default)
pshao25 marked this conversation as resolved.
Show resolved Hide resolved
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ChatClient)}.{nameof(CreateChatThread)}");
scope.Start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public JobRouterAdministrationClient(System.Uri endpoint, Azure.Core.TokenCreden
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.JobRouter.Models.ClassificationPolicy>> CreateClassificationPolicyAsync(Azure.Communication.JobRouter.CreateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Communication.JobRouter.Models.DistributionPolicy> CreateDistributionPolicy(Azure.Communication.JobRouter.CreateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.JobRouter.Models.DistributionPolicy>> CreateDistributionPolicyAsync(Azure.Communication.JobRouter.CreateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Communication.JobRouter.Models.ExceptionPolicy> CreateExceptionPolicy(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
pshao25 marked this conversation as resolved.
Show resolved Hide resolved
public virtual Azure.Response<Azure.Communication.JobRouter.Models.ExceptionPolicy> CreateExceptionPolicy(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.JobRouter.Models.ExceptionPolicy>> CreateExceptionPolicyAsync(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Communication.JobRouter.Models.RouterQueue> CreateQueue(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.JobRouter.Models.RouterQueue>> CreateQueueAsync(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ public virtual async Task<Response<ExceptionPolicy>> CreateExceptionPolicyAsync(
/// <param name="cancellationToken"> (Optional) The cancellation token to use. </param>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
public virtual Response<ExceptionPolicy> CreateExceptionPolicy(
CreateExceptionPolicyOptions options = default,
CreateExceptionPolicyOptions options,
CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateExceptionPolicy)}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ public virtual Response DeleteRepository(string repositoryName, CancellationToke
/// <returns> A new <see cref="ContainerRepository"/> for the desired repository. </returns>
/// <exception cref="ArgumentNullException"> Thrown when <paramref name="repositoryName"/> is null. </exception>
/// <exception cref="ArgumentException"> Thrown when <paramref name="repositoryName"/> is empty. </exception>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
Copy link
Member

Choose a reason for hiding this comment

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

Curious: why was this allowed before? Is this a new analyzer warning, or did the existing analyzer warning change? It would be helpful to update the PR description with the list of changes that are going in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

The existing analyzer warning change. I updated Azure/azure-sdk-tools#6496 (comment)

public virtual ContainerRepository GetRepository(string repositoryName)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
Argument.AssertNotNullOrEmpty(repositoryName, nameof(repositoryName));

Expand All @@ -276,7 +278,9 @@ public virtual ContainerRepository GetRepository(string repositoryName)
/// <exception cref="ArgumentException"> Thrown when <paramref name="repositoryName"/> is empty. </exception>
/// <exception cref="ArgumentNullException"> Thrown when <paramref name="tagOrDigest"/> is null. </exception>
/// <exception cref="ArgumentException"> Thrown when <paramref name="tagOrDigest"/> is empty. </exception>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public virtual RegistryArtifact GetArtifact(string repositoryName, string tagOrDigest)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
Argument.AssertNotNullOrEmpty(repositoryName, nameof(repositoryName));
Argument.AssertNotNullOrEmpty(tagOrDigest, nameof(tagOrDigest));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<PackageTags>Azure ContentSafety</PackageTags>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<GenerateAPIListing>true</GenerateAPIListing>
<NoWarn>$(NoWarn);AZC0002</NoWarn>
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Usage", "AZC0002:DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.", Justification = "CancellationToken can be passed through RequestOptions")]
[assembly: SuppressMessage("Usage", "AZC0001:Use one of the following pre-approved namespace groups (https://azure.github.io/azure-sdk/registered_namespaces.html): Azure.AI, Azure.Analytics, Azure.Communication, Azure.Data, Azure.DigitalTwins, Azure.IoT, Azure.Learn, Azure.Media, Azure.Management, Azure.Messaging, Azure.ResourceManager, Azure.Search, Azure.Security, Azure.Storage, Azure.Template, Azure.Identity, Microsoft.Extensions.Azure", Justification = "Temporary while awaiting namespace group approval", Scope = "namespace", Target = "~N:Azure.Developer.DevCenter")]
[assembly: SuppressMessage("Usage", "AZC0007:DO provide a minimal constructor that takes only the parameters required to connect to the service.", Justification = "False positives on minimal constructors", Scope = "namespaceanddescendants", Target = "~N:Azure.Developer.DevCenter")]
[assembly: SuppressMessage("Usage", "AZC0006:DO provide constructor overloads that allow specifying additional options.", Justification = "False positives on options constructors", Scope = "namespaceanddescendants", Target = "~N:Azure.Developer.DevCenter")]
4 changes: 4 additions & 0 deletions sdk/maps/Azure.Maps.Rendering/src/MapsRenderingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,9 @@ private static GeoPosition GlobalPixelToPosition(GeoPosition pixel, double zoom,
/// <param name="zoom">Zoom level</param>
/// <param name="tileSize">The size of the tiles in the tile pyramid.</param>
/// <returns>A tile index contains the tile X, Y index and zoom level.</returns>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public static MapTileIndex PositionToTileXY(GeoPosition position, int zoom, int tileSize)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
var latitude = Clip(position.Latitude, MinLatitude, MaxLatitude);
var longitude = Clip(position.Longitude, MinLongitude, MaxLongitude);
Expand All @@ -803,7 +805,9 @@ public static MapTileIndex PositionToTileXY(GeoPosition position, int zoom, int
/// <param name="mapTileIndex">Tile X, Y coordinate and zoom level</param>
/// <param name="tileSize">The size of the tiles in the tile pyramid.</param>
/// <returns>A bounding box of the tile defined as an array of numbers in the format of GeoBoundingBox.</returns>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public static GeoBoundingBox TileXYToBoundingBox(MapTileIndex mapTileIndex, int tileSize)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
//Top left corner pixel coordinates
var x1 = (double)(mapTileIndex.X * tileSize);
Expand Down
2 changes: 2 additions & 0 deletions sdk/monitor/Azure.Monitor.Query/src/LogsQueryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,9 @@ public virtual async Task<Response<LogsQueryResult>> QueryResourceAsync(Resource
/// </summary>
/// <param name="query">An interpolated query string.</param>
/// <returns>A valid Kusto query.</returns>
#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
public static string CreateQuery(FormattableString query)
#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods.
{
if (query == null) { return null; }

Expand Down

This file was deleted.

This file was deleted.

Loading