I am working on a Xamarin.Forms PCL project which uses web requests to log users in. It has been working fine since I created the app a couple months ago but suddenly today it stopped working and I haven't changed anything in the login code.
The web request is ran with
var values = new Dictionary<string, string>
{
{"username", username },
{"password", password }
};
var content = new FormUrlEncodedContent(values);
var response = await App.client.PostAsync(App.URL + "account.php", content);
var responseString = await response.Content.ReadAsStringAsync();
string page_result = responseString;
It goes into break mode and says
System.Threading.Tasks.TaskCanceledException: A task was canceled.
When I push the button that runs the web request the output says
03-24 21:29:44.062 E/mono ( 9248): Unhandled Exception: 03-24 21:29:44.062 E/mono ( 9248): System.Threading.Tasks.TaskCanceledException: A task was canceled. 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00026] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x004f5] in :0 03-24 21:29:44.062 E/mono ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Net.Http.HttpClient+d__49.MoveNext () [0x000ca] in :0 03-24 21:29:44.062 E/mono ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0 03-24 21:29:44.062 E/mono ( 9248): at SocialNetwork.LoginPage+d__2.MoveNext () [0x000a1] in C:\Users\Jacob\OneDrive\Documents\Visual Studio\SocialMedia\SocialNetwork\SocialNetwork\LoginPage.xaml.cs:36 03-24 21:29:44.062 E/mono ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.062 E/mono ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in :0 03-24 21:29:44.062 E/mono ( 9248): at SocialNetwork.LoginPage+d__1.MoveNext () [0x0002c] in C:\Users\Jacob\OneDrive\Documents\Visual Studio\SocialMedia\SocialNetwork\SocialNetwork\LoginPage.xaml.cs:23 03-24 21:29:44.062 E/mono ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.062 E/mono ( 9248): at (wrapper dynamic-method) System.Object.b3fe65b9-9c99-495b-aeb4-4948b63ae737(intptr,intptr) 03-24 21:29:44.082 E/mono-rt ( 9248): [ERROR] FATAL UNHANDLED EXCEPTION: System.Threading.Tasks.TaskCanceledException: A task was canceled. 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00026] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x004f5] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Net.Http.HttpClient+d__49.MoveNext () [0x000ca] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at SocialNetwork.LoginPage+d__2.MoveNext () [0x000a1] in C:\Users\Jacob\OneDrive\Documents\Visual Studio\SocialMedia\SocialNetwork\SocialNetwork\LoginPage.xaml.cs:36 03-24 21:29:44.082 E/mono-rt ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in :0 03-24 21:29:44.082 E/mono-rt ( 9248): at SocialNetwork.LoginPage+d__1.MoveNext () [0x0002c] in C:\Users\Jacob\OneDrive\Documents\Visual Studio\SocialMedia\SocialNetwork\SocialNetwork\LoginPage.xaml.cs:23 03-24 21:29:44.082 E/mono-rt ( 9248): --- End of stack trace from previous location where exception was thrown --- 03-24 21:29:44.082 E/mono-rt ( 9248): at (wrapper dynamic-method) System.Object.b3fe65b9-9c99-495b-aeb4-4948b63ae737(intptr,intptr)