>>>> public async Task getPromos(string url) >>>> { >>>> HttpClient client = new HttpClient(); >>>> client.BaseAddress = new Uri(url); >>>> var response = await client.GetAsync(client.BaseAddress); >>>> response.EnsureSuccessStatusCode(); >>>> var JsonResult = response.Content.ReadAsStringAsync().Result; >>>> var promo = JsonConvert.DeserializeObject<PromoResult>(JsonResult); >>>> SetValues(promo); >>>> } >>>>>>>>
>>>>04-13 15:43:15.120 D/Mono (22045): Remapped public key token of retargetable assembly System from 7cec85d7bea7798e to b77a5c561934e089 >>>>04-13 15:43:15.120 D/Mono (22045): The request to load the retargetable assembly System v2.0.5.0 was remapped to System v2.0.5.0 >>>>04-13 15:43:15.122 D/Mono (22045): Unloading image System.dll [0x687ebbe0]. >>>>04-13 15:43:15.122 D/Mono (22045): Image addref System[0x687ed778] -> System.dll[0x66e3b8d0]: 4 >>>>04-13 15:43:15.123 D/Mono (22045): Assembly Ref addref Newtonsoft.Json[0x661d6b50] -> System[0x66e50628]: 12 >>>>04-13 15:43:15.187 D/Mono (22045): Remapped public key token of retargetable assembly System.Runtime.Serialization from 7cec85d7bea7798e to b77a5c561934e089 >>>>04-13 15:43:15.187 D/Mono (22045): The request to load the retargetable assembly System.Runtime.Serialization v2.0.5.0 was remapped to System.Runtime.Serialization v2.0.5.0 >>>>04-13 15:43:15.189 D/Mono (22045): Unloading image System.Runtime.Serialization.dll [0x688487b8]. >>>>04-13 15:43:15.189 D/Mono (22045): Image addref System.Runtime.Serialization[0x68844e08] -> System.Runtime.Serialization.dll[0x6793c188]: 4 >>>>04-13 15:43:15.189 D/Mono (22045): Assembly Ref addref Newtonsoft.Json[0x661d6b50] -> System.Runtime.Serialization[0x6790e188]: 3 >>>>Loaded assembly: Anonymously Hosted DynamicMethods Assembly [External] >>>>04-13 15:43:15.451 D/Mono (22045): Assembly Ref addref m2m[0x65d48a08] -> System.Diagnostics.Debug[0x66154e28]: 3 >>>>>>>
var JsonResult = await response.Content.ReadAsStringAsync().Result;>>
>>namespace m2m { >> public class PromoResult { >> public PromotionObserver promotionObserver { get; set; } >> } >>} >> >>namespace m2m >>{ >> public class PromotionObserver >> { >> public int autocouponlinkpk { get; set; } >> public int subscriberfk { get; set; } >> public DateTime enddate { get; set; } >> public bool hidesharebutton { get; set; } >> public bool iscoupon { get; set; } >> public string coupdescrp { get; set; } >> public bool globalcoupon { get; set; } >> public string imageurl { get; set; } >> public string market_descrp { get; set; } >> public string globallogo { get; set; } >> >> } >>} >> >> >>Apologies - I did not notice the '.Result' on the end of that line (await works if that's removed but the end result is the same). Old post but I wonder if this is relevant : https://forums.xamarin.com/discussion/24077/json-net-4-5-11-not-works-with-latest-xamarin-android-4-16-0
Additional information: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'testapi.Model.PromoResult' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.For some reason the doesn't work very well using Xamarin. The link you pointed me to is another problem that crops up all the time stopping the debugger without any other error then the dll.so is missing. Not sure VS with Xamarin is ready for prime time yet.