Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run time error JsonConvert.DeserializeObject
Message
From
13/04/2016 18:00:39
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
All
General information
Forum:
Visual Studio
Category:
Other
Title:
Run time error JsonConvert.DeserializeObject
Miscellaneous
Thread ID:
01634759
Message ID:
01634759
Views:
66
I am very much a newbe to VS and c# so please be patient.

I am trying to get some data through my Rest service with the end result of building a IOS/Android app using C# and Xamarin. I have going through the steps watching some Pluralsight videos and I have hit a wall. I have the following code.
            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);
            }
When I am in the VS IDE, and hover my mouse over I can see that PromoResult is a class as expected. When I step through the code and get the that line of code, hovering the mouse over PromoResult says that there is no object and that is where the program ends with the errors below. Not sure how to fix this. Any ideas?

Thanks.
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
Next
Reply
Map
View

Click here to load this message in the networking platform