ezet / evelib

Eve Online Library.NET is an open source C# wrapper for CCPs Eve Online API and other popular Eve Online APIs.
Apache License 2.0
71 stars 36 forks source link

"System.AggregateException" while deserializing json data to "InvType" object #102

Closed cemmerven closed 7 years ago

cemmerven commented 8 years ago

For Your Information : var staticData = new EveStaticData(); // 15810 : "Imperial Navy Heat Sink" InvType item = staticData.GetInvType(15810);

while trying to execute above two lines I've experienced "System.AggregateException". response-JSON:

{
"url":"https://element-43.com/api/invType/15810/?format=json", "name":"Imperial Navy Heat Sink", "description":"Dissipates energy weapon damage efficiently, thus allowing them to be fired more rapidly. \r\n\r\nPenalty: Using more than one type of this module or similar modules that affect the same attribute on the ship will be penalized.", "mass":1.0, "volume":5.0, "capacity":0.0, "portion_size":1, "base_price":null, "is_published":true, "market_group":"https://element-43.com/api/invMarketGroup/647/?format=json", "race":null }

FIX : I've changed "eZet.EveLib.StaticDataModule.Models.InvType"s BasePrice property from "double" value type to "nullable-double" type (than json deserializer can be able to handle "base_price":null json ).

FROM: [DataMember(Name = "base_price")] public double BasePrice { get; set; } TO: [DataMember(Name = "base_price")] public double? BasePrice { get; set; }

It worked for me... I might break other things though...

ezet commented 7 years ago

Fixed.