[BUG] ApplicationInsightsManagementClient throws exception on WebTestLocations.ListAsync
See original GitHub issueDescribe 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.TaskAwaiter
1.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)
- 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:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist.
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.