Geocoding.net icon indicating copy to clipboard operation
Geocoding.net copied to clipboard

Missing Bing EntityType enum value `PointOfInterest`

Open ascott18 opened this issue 2 years ago • 3 comments

Geocoding.Microsoft.BingGeocodingException
  HResult=0x80131500
  Message=There was an error processing the geocoding request. See InnerException for more information.
  Source=Geocoding.Microsoft
  StackTrace:
   at Geocoding.Microsoft.BingMapsGeocoder.<GeocodeAsync>d__40.MoveNext()

  This exception was originally thrown at this call stack:
    System.Enum.TryParseByName(System.RuntimeType, System.ReadOnlySpan<char>, bool, bool, out ulong)
    System.Enum.TryParseInt32Enum(System.RuntimeType, System.ReadOnlySpan<char>, int, int, bool, bool, System.TypeCode, out int)
    System.Enum.TryParse(System.Type, System.ReadOnlySpan<char>, bool, bool, out object)
    System.Enum.TryParse(System.Type, string, bool, bool, out object)
    Geocoding.Microsoft.BingMapsGeocoder.ParseResponse(Geocoding.Microsoft.Json.Response)
    Geocoding.Microsoft.BingMapsGeocoder.GeocodeAsync(string)

Inner Exception 1:
ArgumentException: Requested value 'PointOfInterest' was not found.

ascott18 avatar Apr 26 '22 19:04 ascott18

Another one - GeoRegion

Geocoding.Microsoft.BingGeocodingException: There was an error processing the geocoding request. See InnerException for more information.
 ---> System.ArgumentException: Requested value 'GeoRegion' was not found.
   at System.Enum.TryParseByName(RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)
   at System.Enum.TryParseInt32Enum(RuntimeType enumType, ReadOnlySpan`1 value, Int32 minInclusive, Int32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, Int32& result)
   at System.Enum.TryParse(Type enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at System.Enum.TryParse(Type enumType, String value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at Geocoding.Microsoft.BingMapsGeocoder.ParseResponse(Response response)
   at Geocoding.Microsoft.BingMapsGeocoder.GeocodeAsync(String address)
   --- End of inner exception stack trace ---
   at Geocoding.Microsoft.BingMapsGeocoder.GeocodeAsync(String address)
   at Geocoding.Microsoft.BingMapsGeocoder.Geocoding.IGeocoder.GeocodeAsync(String address)

ascott18 avatar Apr 27 '22 04:04 ascott18

Hello @ascott18, can you at least share your request payload and more information to be able to reproduce the issue.

chatay avatar Jun 04 '22 10:06 chatay

Unfortunately the request payload includes privileged customer data that I cannot share.

The issue here is quite straightforward - there are enum values that Bing will return that this library does not support.

~~PointOfInterest is defined here in the official bing SDK - https://github.com/microsoft/bing-search-sdk-for-net/blob/1fec1d7bb3776cca86db7b6fcd340e59db3d0d3c/sdk/EntitySearch/src/Generated/Models/EntityType.cs#L39. Note that the official SDK simply uses strings for these values, not enums, since the API could start returning new values at any time. GeoRegion seems to be so new that it doesn't even have a declared const in the official SDK.~~ Sorry, I realized that the bing search SDK is not actually the bing maps SDK - there doesn't seem to be a bing maps SDK.

ascott18 avatar Jun 14 '22 17:06 ascott18