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

[BUG] Exception when calling KeyVaultManagementClient.Vaults.CheckNameAvailabilityAsync #1311

Open
3 tasks done
jag43 opened this issue May 16, 2022 · 2 comments
Open
3 tasks done

Comments

@jag43
Copy link

jag43 commented May 16, 2022

Describe the bug
Exception when calling KeyVaultManagementClient.Vaults.CheckNameAvailabilityAsync

Exception or Stack Trace
Message: Unable to deserialize the response.
StackTrace:

   at Microsoft.Azure.Management.KeyVault.VaultsOperations.<CheckNameAvailabilityWithHttpMessagesAsync>d__16.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.Azure.Management.KeyVault.VaultsOperationsExtensions.<CheckNameAvailabilityAsync>d__23.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

Inner1 Message: Error converting value "Invalid" to type 'System.Nullable`1[Microsoft.Azure.Management.KeyVault.Models.Reason]'. Path 'reason', line 1, position 41.
Inner 1 StackTrace:

   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
   at Microsoft.Azure.Management.KeyVault.VaultsOperations.<CheckNameAvailabilityWithHttpMessagesAsync>d__16.MoveNext()

Inner2 Message: Requested value 'Invalid' was not found.
Inner2 StackTrace:

   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)

To Reproduce
Call KeyVaultManagementClient.Vaults.CheckNameAvailabilityAsync with an invalid name (in our case the name was too long)

Code Snippet
var checkNameAvailabilityResponse = await keyVaultClient.Vaults.CheckNameAvailabilityAsync(new VaultCheckNameAvailabilityParameters(keyVaultName), cancellationToken);

Expected behavior
No exception to be thrown, response is able to deserialized and we get invalid name in the response

Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: [e.g. iOS]
    • Windows 10
  • IDE : [e.g. IntelliJ]
    • Visual studio
  • Version of the Library used
    • Microsoft.Azure.Management.KeyVault, Version=3.1.0.0

Additional context
None

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@jag43
Copy link
Author

jag43 commented May 16, 2022

It seems that the azure management api returns Invalid but the only enum values are AccountNameInvalid and AlreadyExists
(link)

@weidongxu-microsoft
Copy link
Member

The lib is in maintenance (and to be deprecated).

Please plan migrate to https://aka.ms/azsdk/dotnet/mgmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants