azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] IContainerRegistryManagementClient.Registries.ListCredentialsAsync always throws TaskCanceledException

Open kceiw opened this issue 4 years ago • 4 comments
trafficstars

Describe the bug I call the above method to get the credential on a container registry, it always throws TaskCanceledException.

Expected behavior Returns successfully.

Actual behavior (include Exception or Stack Trace) It always throws the exception TaskCanceledException

I set ServiceClientTracing.IsEnabled = true; and the interceptor to trace the rest api calls.

Information: 0 : Arm Tracing 1, Enter method ListCredentials
Information: 0 : Arm Tracing 1, Send request Method: POST, RequestUri: 'https://management.azure.com/subscriptions/<REMOVED>/resourceGroups/smlrp-dev-westus2/providers/Microsoft.ContainerRegistry/registries/smlrpdevwus2/listCredentials?api-version=2019-05-01', Version: 1.1, Content: <null>, Headers:
{
  x-ms-client-request-id: <Removed>
  Accept-Language: en-US
  Authorization: Bearer <Removed>
}

Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll

The exception is just thrown after the request is sent.

I used the url and the bearer token in Postman and the request returns quickly with the credentials.

To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

  1. auth and get the access token to the Azure management endpoint https://management.core.windows.net/.
  2. The access token is a string. Convert it to TokenCredentials by var credentials = new Microsoft.Rest.TokenCredentials(accessString).
  3. Create the ContainerRegistryManagementClient via var registryManagementClient = new ContainerRegistryManagementClient(credentials) { SubscriptionId = "YourSubscriptionId" }.
  4. Call the api registryManagementClient.Registries.ListCredentialsAsync(this.ResourceGroupName, this.Name, cancellationToken.

Environment:

  • Name and version of the Library package used: Microsoft.Azure.Management.ContainerRegistry, version 4.0.0
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): [e.g. Azure AppService or Windows 10 .NET Framework 4.8] Windows 10, ASP.Net Core 3.1
  • IDE and version : [e.g. Visual Studio 16.3] Visual Studio 16.10.Preview 2

kceiw avatar Mar 19 '21 00:03 kceiw

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Mar 19 '21 12:03 jsquire

Thanks for your feedback, re-routing to service team.

JonathanCrd avatar Mar 19 '21 18:03 JonathanCrd

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @toddysm, @yugangw-MSFT.

Issue Details

Describe the bug I call the above method to get the credential on a container registry, it always throws TaskCanceledException.

Expected behavior Returns successfully.

Actual behavior (include Exception or Stack Trace) It always throws the exception TaskCanceledException

I set ServiceClientTracing.IsEnabled = true; and the interceptor to trace the rest api calls.

Information: 0 : Arm Tracing 1, Enter method ListCredentials
Information: 0 : Arm Tracing 1, Send request Method: POST, RequestUri: 'https://management.azure.com/subscriptions/<REMOVED>/resourceGroups/smlrp-dev-westus2/providers/Microsoft.ContainerRegistry/registries/smlrpdevwus2/listCredentials?api-version=2019-05-01', Version: 1.1, Content: <null>, Headers:
{
  x-ms-client-request-id: <Removed>
  Accept-Language: en-US
  Authorization: Bearer <Removed>
}

Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll

The exception is just thrown after the request is sent.

I used the url and the bearer token in Postman and the request returns quickly with the credentials.

To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

  1. auth and get the access token to the Azure management endpoint https://management.core.windows.net/.
  2. The access token is a string. Convert it to TokenCredentials by var credentials = new Microsoft.Rest.TokenCredentials(accessString).
  3. Create the ContainerRegistryManagementClient via var registryManagementClient = new ContainerRegistryManagementClient(credentials) { SubscriptionId = "YourSubscriptionId" }.
  4. Call the api registryManagementClient.Registries.ListCredentialsAsync(this.ResourceGroupName, this.Name, cancellationToken.

Environment:

  • Name and version of the Library package used: Microsoft.Azure.Management.ContainerRegistry, version 4.0.0
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): [e.g. Azure AppService or Windows 10 .NET Framework 4.8] Windows 10, ASP.Net Core 3.1
  • IDE and version : [e.g. Visual Studio 16.3] Visual Studio 16.10.Preview 2
Author: kceiw
Assignees: -
Labels:

Container Registry, Mgmt, Service Attention, needs-team-attention

Milestone: -

ghost avatar Mar 19 '21 18:03 ghost

@HarveyLink please help to check if this issue still exists in the new Track 2 sdk

ArthurMa1978 avatar Jan 10 '23 06:01 ArthurMa1978

Hi @kceiw, here is a simple sample of how to get the credential on a container registry in new track 2 Following packages are used in this sample: Azure.ResourceManager.ContainerRegistry

ResourceGroupResource rg = await CreateResourceGroupAsync(Subscription, "testRg", AzureLocation.WestUS); var registryCollection = rg.GetContainerRegistries(); var registryName = Recording.GenerateAssetName("acrregistry"); ContainerRegistryResource registryFromGet = await registryCollection.GetAsync(registryName); ContainerRegistryListCredentialsResult credentials = await registryFromGet.GetCredentialsAsync();

mcgallan avatar Jan 12 '23 09:01 mcgallan

Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

ghost avatar Mar 23 '23 14:03 ghost