Given:
using Uno;
using Uno.Net.Http;
public partial class HTTP
{
public HTTP() {
try {
InitializeUX();
var c = new Uno.Net.Http.HttpMessageHandler();
var request = c.CreateRequest("POST", "http://www.gfhjksgfdhjkdgfslkgoogle.com");
request.SetHeader("Content-type", "application/json");
request.SetResponseType(HttpResponseType.String);
request.Done += RequestSucceeded;
request.Error += RequestFailed;
request.SendAsync("WHAT");
debug_log "Ran constructor";
} catch (Exception ex) {
debug_log "WOW, that failed";
}
}
static void RequestSucceeded(HttpMessageHandlerRequest request) {
debug_log "REQUEST SUCCEEDED";
}
static void RequestFailed(HttpMessageHandlerRequest request, string errorMessage) {
try {
debug_log "REQUEST FAILED MISESABLY: " + errorMessage;
debug_log "RESPONSE STATUS: " + request.GetResponseStatus();
} catch {
debug_log "CAUGHT EXCEPTION";
}
}
}
This yields:
I/HTTP ( 8340): Ran constructor
I/HTTP ( 8340): REQUEST SUCCEEDED
However, if you turn off WIFI and mobile data, the app will consistently crash when trying to do request.GetResponseStatus(). It will CRASH the app violently.
Wrapping the call in try/catch doesn’t work either, so this must be a platform implementation problem.