Forum Xamarin.Forms

HttpClient calling SendAsync on a GET

wallymwallym USInsider, Beta ✭✭✭
edited March 4 in Xamarin.Forms

I've got the following old code:

var uri = String.Format("{0}//{1}/{2}?PlayerToken={3}", protocol, servername, tournamentsInClubUrl, userToken);
var httpC = new HttpClient();
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
requestMessage.Headers.Add("AppKey", AppKey);
var body = await httpC.SendAsync(requestMessage); <-- Error right here
var str = await body.Content.ReadAsStringAsync();
var res = JsonConvert.DeserializeObject<List<PicVideoApp.Models.TournamentInfo>>(str);

I am getting an error when I attempt to call SendAsync. I have never seen this before, so I am lost on what to do. I can manually call the url and perform a get, so I don't think the json service is the issue. The error occurs on iOS on a device. In Android, it works. Anybody got any ideas? The error message is below. TIA.

2020-03-03 17:09:44.254 PicVideoApp.iOS[3488:869450] error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2019-08/ios/release/mono/mini/interp/interp.c:2160, condition `is_ok (error)' not met, function:do_jit_call, Attempting to JIT compile method '(wrapper other) void object:gsharedvt_out_sig (object&,single&,int&,intptr)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
assembly: type: member:(null)

Tagged:

Answers

  • AsfendYarAsfendYar USMember ✭✭✭

    Hi Wallym ! There's a lot of discussion on this SendAsync topic already on the Xamarin Forums.
    Let me share a link with you where you can get your answer.
    https://forums.xamarin.com/discussion/103464/httpclient-sendasync-unexpected-behavior-works-fine-in-windows-app

  • wallymwallym USInsider, Beta ✭✭✭

    @AsfendYar Thanks for the suggestion, but that doesn't seem to be what I am running into.

  • CAESCAES Member ✭✭
    > @wallym said:
    > I've got the following old code:
    >
    > var uri = String.Format("{0}//{1}/{2}?PlayerToken={3}", protocol, servername, tournamentsInClubUrl, userToken);var httpC = new HttpClient();HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, uri);requestMessage.Headers.Add("AppKey", AppKey);var body = await httpC.SendAsync(requestMessage); <-- Error right herevar str = await body.Content.ReadAsStringAsync();var res = JsonConvert.DeserializeObject<List<PicVideoApp.Models.TournamentInfo>>(str);
    >
    > I am getting an error when I attempt to call SendAsync. I have never seen this before, so I am lost on what to do. I can manually call the url and perform a get, so I don't think the json service is the issue. The error occurs on iOS on a device. In Android, it works. Anybody got any ideas? The error message is below. TIA.
    >
    > 2020-03-03 17:09:44.254 PicVideoApp.iOS[3488:869450] error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2019-08/ios/release/mono/mini/interp/interp.c:2160, condition `is_ok (error)' not met, function:do_jit_call, Attempting to JIT compile method '(wrapper other) void object:gsharedvt_out_sig (object&,single&,int&,intptr)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
    > assembly: type: member:(null)

    Could you do something for me?
    Try to use the SendAsync with some other parameter for test purpose, also, try to use the Refit library, it could help you a lot...
Sign In or Register to comment.