Jericho / ZoomNet

.NET client library for the Zoom.us REST API v2
MIT License
69 stars 46 forks source link

Users.GetSettingsAsync throws a region enumeration error #267

Closed michael-aj-kennedy closed 1 year ago

michael-aj-kennedy commented 1 year ago

We have some code which iterates through a list of users and retrieves a list of settings for each user by calling client.Users.GetSettingsAsync(user.Id).

This code is throwing the following error:

System.ArgumentException: There is no value in the DataCenterRegion enum that corresponds to 'TW'. 
at ZoomNet.Internal.ToEnum[T](String str) 
at ZoomNet.Json.StringEnumConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) 
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) 
at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value) 
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) 
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) 
<snip>

We've been using ZoomNet v0.51.1 for a while & haven't seen any problems with this function, implying that Zoom have changed something which has had a knock-on effect here. Upgraded to 0.57 and still experiencing the same error.

We've tested against multiple users & are experiencing the same error for each of them (none of whom are setup with what I assume is the Taiwanese region).

Jericho commented 1 year ago

ZoomNet contains a short list of 14 date center regions such as United Sates, Canada, Europe, etc. which I derived from the documentation for the data_center_regions field. Sounds like Zoom added a bunch of regions (42 to be exact) on January 9 2023 based on the "last modified" date here. I need to incorporate these additional data center regions to the DataCenterRegion enumeration in ZoomNet.

However, I'm confused by the fact that I don't see TW on this list of additional regions???

Jericho commented 1 year ago

Fun fact: Tokyo is present in the original list of 14 data center region and it's duplicated in the list of additional regions. This means that there are 41 additional regions, not 42.

Jericho commented 1 year ago

I added all the new regions, also added TW and published a beta for you to try. I am confident it will solve the problem for users configured in the Taiwanese region. Let me know if it indeed solves the problem and I will publish to NuGet.

michael-aj-kennedy commented 1 year ago

Hi @Jericho

Well it's better than it was... I'm getting the same error, but this time for the CH region, which also doesn't appear in Zoom's list of region codes!

System.ArgumentException: There is no value in the DataCenterRegion enum that corresponds to 'CH'. 
at ZoomNet.Internal.ToEnum[T](String str) 
at ZoomNet.Json.StringEnumConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) 
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
michael-aj-kennedy commented 1 year ago

I've done some additional testing using our code and a modified version of the ZoomNet codebase. It's looking like the only missing properties are TW (presumably Taiwan) and CH (which I thought was a duplicate of China, but google suggests represents Switzerland).

If I add both of these to DataCenterRegion then the error goes away.

Jericho commented 1 year ago

Added Switzerland and I am in the process of publishing 0.58.0 to NuGet. Should be publicly available in the next 30 minutes or so.

Fingers crossed: I hope we don't find any more "undocumented" regions!

Jericho commented 1 year ago

:tada: This issue has been resolved in version 0.58.0 :tada:

The release is available on:

Your GitReleaseManager bot :package::rocket:

michael-aj-kennedy commented 1 year ago

Works perfectly. Thanks for getting that done so quickly!