Bug 20611 - Customer having issues parsing Int and DateTime since upgrade
Summary: Customer having issues parsing Int and DateTime since upgrade
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.8.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-06-16 05:24 UTC by Mike James
Modified: 2014-06-18 11:00 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Mike James 2014-06-16 05:24:38 UTC
The customer is trying to parse the following with RestSharp: 

[{"accountId":"8a18da01424f4504bb5ed024e9dec75c","amount":-190,"categorized":null,"categorizedBy":null,"categoryId":"2612430cf2da4d068798302eca5067f2","categoryType":"EXPENSES","credentialsId":"295de0b6bdb3405c9cb1df3eb0cf5e6d","date":1401616800000,"description":"Pascha
Deli","formattedDescription":null,"id":"2af44d05e8da4127ac6d8eb18760226e","inserted":1401656963060,"lastModified":1401656965000,"location":{"accuracy":null,"address":"Kungsgatan
15","city":"Stockholm","country":null,"coordinate":{"latitude":59.3359588,"longitude":18.0690692}},"merchantId":null,"notes":null,"originalAmount":-190,"originalDate":1401616800000,"originalDescription":"Pascha
Deli","pending":false,"timestamp":1401656963061,"type":"DEFAULT","userId":"aa6a0eef78aa4e00820ccc6c6672d405","userModifiedAmount":false,"userModifiedCategory":false,"userModifiedDate":false,"userModifiedDescription":false,"userModifiedLocation":false,"payload":{}},{"accountId":"8a18da01424f4504bb5ed024e9dec75c","amount":-325,"categorized":null,"categorizedBy":null,"categoryId":"17df760670d1488b89b5905194523a7f","categoryType":"EXPENSES","credentialsId":"295de0b6bdb3405c9cb1df3eb0cf5e6d","date":1401616800000,"description":"Zara
Woman","formattedDescription":null,"id":"5bd430650f414dc5b66848fa9600dd02","inserted":1401656963060,"lastModified":1401656965000,"location":null,"merchantId":null,"notes":null,"originalAmount":-325,"originalDate":1401616800000,"originalDescription":"Zara
Woman","pending":false,"timestamp":1401656963064,"type":"DEFAULT","userId":"aa6a0eef78aa4e00820ccc6c6672d405","userModifiedAmount":false,"userModifiedCategory":false,"userModifiedDate":false,"userModifiedDescription":false,"userModifiedLocation":false,"payload":{}},{"accountId":"8a18da01424f4504bb5ed024e9dec75c","amount":-318,"categorized":null,"categorizedBy":null,"categoryId":"17df760670d1488b89b5905194523a7f","categoryType":"EXPENSES","credentialsId":"295de0b6bdb3405c9cb1df3eb0cf5e6d","date":1401616800000,"description":"Zara
Woman","formattedDescription":null,"id":"8f5c6c0fb2734b99be45bdb7e17e9b05","inserted":1401656963060,"lastModified":1401656965000,"location":null,"merchantId":null,"notes":null,"originalAmount":-318,"originalDate":1401616800000,"originalDescription":"Zara
Woman","pending":false,"timestamp":1401656963065,"type":"DEFAULT","userId":"aa6a0eef78aa4e00820ccc6c6672d405","userModifiedAmount":false,"userModifiedCategory":false,"userModifiedDate":false,"userModifiedDescription":false,"userModifiedLocation":false,"payload":{}}]


And gets the following error:

[MonoDroid] UNHANDLED EXCEPTION: System.FormatException: The specified
format '' is invalid
[MonoDroid] at System.NumberFormatter.IntegerToString
(string,System.IFormatProvider) <IL 0x0010a, 0x00590>
[MonoDroid] at System.NumberFormatter.NumberToString
(string,long,System.IFormatProvider) <IL 0x00012, 0x000cf>
[MonoDroid] at System.NumberFormatter.NumberToString
(long,System.IFormatProvider) <IL 0x0001b, 0x0013f>
[MonoDroid] at long.ToString (System.IFormatProvider) <IL 0x00003, 0x00053>
[MonoDroid] at System.Convert.ToString (object,System.IFormatProvider) <IL
0x00012, 0x00203>
[MonoDroid] at RestSharp.Deserializers.JsonDeserializer.ConvertValue
(System.Type,object) [0x00008] in
/Users/jonnilsson/Projects/tink-frontend-mobile/Vendor/RestSharp/RestSharp/Deserializers/JsonDeserializer.cs:165
tem.Collections.Generic.List`1<Tink.Transaction>> (RestSharp.IRestResponse)
<0x00467>

He has also found that the following causes issues and believes these to be related:

TimeZoneInfo.ConvertFromUtc 
throws System.TimeZoneNotFoundException

This works as expected with: Xamarin.Android to 4.12.3 but fails on: Xamarin.Android 4.12.4
Comment 2 Jonathan Pryor 2014-06-18 11:00:52 UTC
This is the exception:

> [MonoDroid] UNHANDLED EXCEPTION: System.FormatException: Invalid format string
> [MonoDroid] at System.DateTime.ParseExact (string,string[],System.IFormatProvider,System.Globalization.DateTimeStyles)
> [MonoDroid] at System.DateTime.ParseExact (string,string,System.IFormatProvider,System.Globalization.DateTimeStyles)
> [MonoDroid] at System.DateTime.ParseExact (string,string,System.IFormatProvider)
> [MonoDroid] at bug_20611.MainActivity.RestSharpDeserialize () [0x00080] in /Users/jatin66/Desktop/bug_20611/bug_20611/MainActivity.cs:64


MainActivity.cs:64 is:

> dtDate = DateTime.ParseExact(AccountList[i].Date, "yyyy-MM-dd", CultureInfo.InvariantCulture);

Logical question: what is the value of AccountList[i].Date?

Answer: 1401616800000.

Which means the above statement is equivalent to:

    var dtDate = DateTime.ParseExact(
            "1401616800000",
            "yyyy-MM-dd",
            CultureInfo.InvariantCulture);

Which fails even in .NET, because "1401616800000" is not in the format "yyyy-MM-dd".

Furthermore, when testing this on 4.12.3-3 the provided test case fails with the same FormatException, so this doesn't appear to be a change.