Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

HTTP calls in Xamarin.iOS app crashes when sending app to background

I am using C# HttpClient to send HTTP call in my Xamarin.iOS apps. But when I send my app to background or even when the call is sent I open control center or notification center my app crashes gives OperationCanceledException. I am using delegates as callback in these calls when ever I get a response from server. Is there any way to stop my app from crashing.

This is the exception that is being raised.

System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Net.Http.NSUrlSessionHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x001d4] in /Library/Frameworks/Xamarin.iOS.framework/Versions/
at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x0017e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:506 at API.Entities.Support.SupportAPI.SupportData (API.Entities.Support.SupportAPI+SupportAPIDelegate1[T] callback) [0x001ab] in /Users/zshakil/Desktop/Projects/Support/API/Entities/SupportAPI.cs:271 }


Sign In or Register to comment.