question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] ApplicationInsightsManagementClient throws exception on WebTestLocations.ListAsync

See original GitHub issue

Describe the bug Unable to deserialize the response ApplicationInsightsManagementClient.WebTestLocations.ListAsync

Expected behavior I would not expect an errors

Actual behavior (include Exception or Stack Trace) Microsoft.Rest.SerializationException HResult=0x80131500 Message=Unable to deserialize the response. Source=Microsoft.Azure.Management.ApplicationInsights StackTrace: at Microsoft.Azure.Management.ApplicationInsights.Management.WebTestLocationsOperations.<ListWithHttpMessagesAsync>d__5.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Management.ApplicationInsights.Management.WebTestLocationsOperationsExtensions.<ListAsync>d__1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at AppInsightsApi.Program.<Main>d__0.MoveNext() in C:\Users\sesa220553\source\repos\AppInsightsApi\AppInsightsApi\Program.cs:line 55

This exception was originally thrown at this call stack: [External Code]

Inner Exception 1: JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type ‘Microsoft.Azure.Management.ApplicationInsights.Management.Models.Page1`1[Microsoft.Azure.Management.ApplicationInsights.Management.Models.ApplicationInsightsComponentWebTestLocation]’ because the type requires a JSON object (e.g. {“name”:“value”}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {“name”:“value”}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path ‘’, line 1, position 1.

It does return an expected response just seems like the sdk can’t deal with it. The response is similar to [{“DisplayName”:“North Central US”,“Tag”:“us-il-ch1-azr”},{“DisplayName”:“West Europe”,“Tag”:“emea-nl-ams-azr”},{“DisplayName”:“Southeast Asia”,“Tag”:“apac-sg-sin-azr”},{“DisplayName”:“West US”,“Tag”:“us-ca-sjc-azr”},{“DisplayName”:“South Central US”,“Tag”:“us-tx-sn1-azr”},{“DisplayName”:“East US”,“Tag”:“us-va-ash-azr”},{“DisplayName”:“East Asia”,“Tag”:“apac-hk-hkn-azr”},{“DisplayName”:“North Europe”,“Tag”:“emea-gb-db3-azr”},{“DisplayName”:“Japan East”,“Tag”:“apac-jp-kaw-edge”},{“DisplayName”:“Australia East”,“Tag”:“emea-au-syd-edge”},{“DisplayName”:“France Central (Formerly France South)”,“Tag”:“emea-ch-zrh-edge”},{“DisplayName”:“France Central”,“Tag”:“emea-fr-pra-edge”},{“DisplayName”:“UK South”,“Tag”:“emea-ru-msa-edge”},{“DisplayName”:“UK West”,“Tag”:“emea-se-sto-edge”},{“DisplayName”:“Brazil South”,“Tag”:“latam-br-gru-edge”},{“DisplayName”:“Central US”,“Tag”:“us-fl-mia-edge”}]

I can get this info by using ServiceClientTracing and intercepting the response and calling response.Content.ReadAsStringAsync().Result.

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

  1. Create new ApplicationInsightsManagementClient
var creds = SdkContext.AzureCredentialsFactory.FromServicePrincipal(_azureClientId, _azureClientSecret, _directoryId, _azureGlobalCloud);
AppInsights = new ApplicationInsightsManagementClient(creds){SubscriptionId = _subscriptionId};
// Will throw on the below line
var locations = await AppInsights.WebTestLocations.ListAsync("common", "MyAppinsights Instance");

Environment:

  • Microsoft.Azure.Management.ApplicationInsight 0.3.0-preview
  • Net core 3.1 or Framework 4.8
  • IDE and version : Visual Studio 16.7.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jsquirecommented, Oct 27, 2020

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

0reactions
msftbot[bot]commented, Jan 4, 2022

Hi @erik-hooper, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating and Throwing Exceptions
Learn about creating and throwing exceptions. Exceptions are used to indicate that an error has occurred while running a program.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found