Hello!
I have an error on a mobile app that uses ArcGis Xamarin SDK. I use it for IOS and Android mobile apps.
Exception: Esri.ArcGISRuntime.ArcGISRuntimeException. Attempted to use invalid JSON: Range domain ranges only supports int16, int32, float32, float64, and DateTime values.
Issue: ArcGis SDK throws an exception for gis data. The application uses Esri.ArcGISRuntime.Xamarin.Forms 100.8.0. The issue is into a method LoadAsync(). LoadAsync requests for the data to ArcGIS servers, parses data and saves it locally. It's impossible to influence on that logic from our side. ArcGis allows fields with type “range” for int, dates. For instance, a user can set a field value to 10 points where the range is [4; 100], or a date field value from 2021 to 2022. Such fields causes an exception in ArcGis Xamarin library. The issue is in LoadAsync. The method couldn’t parse a json file which describes a layer with a range type.
I noticed If I set a range block in JSON file to null it works (when I change a response by Fiddler). So the issue is in a parsing the fields with a range type.
Tries: I installed the latest version 100.14.1, and it still throws an exception.
Env: macOS Monterey 12.4 on M1, .Net 6.0, Xamarin IOS 15.10.0.5, netstandard 2.0, Esri.ArcGISRuntime 100.14.1, Esri.ArcGISRuntime.Xamarin.Forms 100.14.1
Json fragment:
{ 2"name": "Depth", 3"type": "esriFieldTypeSmallInteger", 4"alias": "Depth", 5"sqlType": "sqlTypeOther", 6"nullable": true, 7"editable": true, 8"domain": { 9 "type": "range", 10 "name": "Depth", 11 "mergePolicy": "esriMPTDefaultValue", 12 "splitPolicy": "esriSPTDefaultValue", 13 "range": [0, 144] 14 }, 15"defaultValue": null 16}
{ 2"name": "TestDate", 3"type": "esriFieldTypeDate", 4"alias": "TestDate", 5"sqlType": "sqlTypeOther", 6"length": 8, "nullable": true, 7"editable": true, 8"domain": { 9 "type": "range", 10 "name": "TestDate", 11 "mergePolicy": "esriMPTDefaultValue", 12 "splitPolicy": "esriSPTDuplicate", 13 "range": ["1/1/1980 12:00:00 AM", "1/1/2114 12:00:00 AM"] 14 }, 15"defaultValue": null 16}
Where is the JSON coming from? Looking at the range domain, when using dates, it needs to be an epoch (milliseconds since 1970) and not a string.
It's a json fragment from esri. AndArcGis SDK throws an exception for the datas from esri, for any domain.
ESRI's user sets a data, the user couldn't set a string or miliseconds or etc. The ESRI system saves user's data (date/number) and sends it in a response to our request to esri as I described above.