jcheng31 / DarkSkyApi

An unofficial C# library for the Dark Sky weather service. Targets .NET Standard 1.1.
MIT License
32 stars 18 forks source link

System.Runtime.Serialization.SerializationException #6

Closed appfinity closed 9 years ago

appfinity commented 9 years ago

There seems to be a problem retrieving weather data for international locations using this library. When I use this code: var fc = new ForecastIOPortable.ForecastApi(<API key>); Forecast ForecastData = await fc.GetWeatherDataAsync(latitude, longitude,units,ForecastIOPortable.Language.English);

That code works perfectly fine for US, UK, etc locations, but when I try a place like Mumbai, India, I get the exception mentioned above.

Exception Details: There was an error deserializing the object of type ForecastIOPortable.Models.Forecast. Input string was not in a correct format.

Note that this is just came up in the 1.5 release of my extremely popular WP weather app Atmosphere. Can you please look into this issue ASAP before I lose more international users?

jcheng31 commented 9 years ago

Sure - I've found one problem so far (the time zone offset should be a double, not an int); going to test it a little more (with the various different units) before pushing an update to NuGet (hopefully later today).

Are there any other cities which you've found cause it to break?

appfinity commented 9 years ago

Any city in India seems to be broken, and probably a few in Europe. The issue, now what you explain it is an int, not a double, makes so much sense. India has a timezone offset of 5.5 (a decimal) and an Int does not support decimals. That should be causing the entire problem.

jcheng31 commented 9 years ago

Alright, I've pushed it to NuGet as version 2.1.2 - let me know if there're any other issues :)

appfinity commented 9 years ago

Alright, trying it out now. Thank you for the prompt response.