Azure AD Mobile Authentication using Common Tenant - c#

I'm writing a Xamarin app, and I'd like to give my users the ability to sign in with Azure AD from any tenant. In the world of web apps, you can do that using the common tenant; however, for some reason it seems like that's a problem for mobile apps.
Based on https://azure.microsoft.com/en-gb/documentation/articles/app-service-mobile-dotnet-how-to-use-client-library/#adal, my client code looks like this:
private async Task AadAuthenticateAsync()
{
const string authority = "https://login.microsoftonline.com/common";
const string resourceId = "<My Resource ID>";
const string clientId = "<My Client ID>";
string redirectUri = $"{AppSettings.ServerUri}/.auth/login/done";
try
{
var authContext = new AuthenticationContext(authority);
var authResult = await authContext.AcquireTokenAsync(resourceId, clientId, new Uri(redirectUri), new PlatformParameters(this));
var payload = new JObject { ["access_token"] = authResult.AccessToken };
_user = await _client.LoginAsync(MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory, payload);
}
catch (Exception ex)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetMessage(ex.Message);
builder.SetTitle("You must log in. Login Required");
builder.Create().Show();
}
}
However, when I sign in using this flow, the _client.LoginAsync step throws an exception, saying "You do not have permission to view this directory or page".
My web app is already configured to be multi-tenant, so I would have expected this flow to work as expected. Am I missing something, or is there another way to do this, given that it should be a fairly common use case?
UPDATE
When I first set this system up, I used a tenant without any users as my realm. All other tenants, including the tenant containing my own users, will be signing in using the common tenant. Following Saca's suggestion, I set up a user in mytenant.onmicrosoft.com, and signing in as that user works without a hitch: both for the authority login.microsoftonline.com/mytenant.onmicrosoft.com and login.microsoftonline.com/common. However, any user from any other tenant blows up with the same exception. In other words, although I've set the web app up as a multi-tenant app, mobile authentication seems not to accept the multi-tenant use case.
The request URL that gets invoked by _client.LoginAsync() is /.auth/login/aad.
UPDATE 2 At Saca's request, here is the stack trace:
at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+d__18.MoveNext () [0x0022f] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+d__1d.MoveNext () [0x0010d] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+d__4.MoveNext () [0x00118] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+d__0.MoveNext () [0x0008d] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
at Microsoft.WindowsAzure.MobileServices.MobileServiceAuthentication+d__0.MoveNext () [0x0006d] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
at Oceanus.Droid.MainActivity+d__9.MoveNext () [0x001cd] in C:\Users\Rob Lyndon\Documents\GitHub\Oceanus\Oceanus\Oceanus.Droid\MainActivity.cs:103

Related

HTTP Request Exception Xamarin Forms

I am sending a large video file (average file size of 50mb) to my server using HttpClient and PostAsync. I am getting an exception (see below for full exception details). I found a article that the maximimum file size that can be handled is 1mb or less is this true? If so, how can I increase the maximum file size?
{System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.IO.IOException: Error writing request ---> System.Net.Sockets.SocketException: The socket has been shut down
at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, System.Boolean throwOnError, System.IAsyncResult result) [0x000cc] in <2016f34fb49d404d9e9f5c5e62749987>:0
at System.Net.WebConnectionStream.WriteAsyncCB (System.IAsyncResult r) [0x00013] in <2016f34fb49d404d9e9f5c5e62749987>:0
--- End of inner exception stack trace ---
at System.Net.WebConnectionStream.EndWrite (System.IAsyncResult r) [0x000b8] in <2016f34fb49d404d9e9f5c5e62749987>:0
at System.IO.Stream+<>c.b__53_1 (System.IO.Stream stream, System.IAsyncResult asyncResult) [0x00000] in :0
at (wrapper delegate-invoke) System.Func3[System.IO.Stream,System.IAsyncResult,System.Threading.Tasks.VoidTaskResult].invoke_TResult_T1_T2(System.IO.Stream,System.IAsyncResult)
at System.Threading.Tasks.TaskFactory1+FromAsyncTrimPromise1[TResult,TInstance].Complete (TInstance thisRef, System.Func3[T1,T2,TResult] endMethod, System.IAsyncResult asyncResult, System.Boolean requiresSynchronization) [0x00000] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in :0
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x0036e] in :0
--- End of inner exception stack trace ---
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x00489] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <df077aeeed724748974ac70c763795f3>:0
at System.Net.Http.HttpClient+<SendAsyncWorker>d__49.MoveNext () [0x000ca] in <e4f3fb4cf2054f718c1099b587ec6f1e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <df077aeeed724748974ac70c763795f3>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <df077aeeed724748974ac70c763795f3>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <df077aeeed724748974ac70c763795f3>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <df077aeeed724748974ac70c763795f3>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0
at TBSMobile.View.MainMenu+d__22.MoveNext () [0x00b96] in C:\Users\lawre\source\repos\TBSMobile\TBSMobile\TBSMobile\View\MainMenu.xaml.cs:1088 }
byte[] crVideoData;
if (!string.IsNullOrEmpty(crvideo))
{
crVideoData = File.ReadAllBytes(crvideo);
}
else
{
crVideoData = null;
}
try
{
if (!string.IsNullOrEmpty(crvideo))
{
var vidlink = "http://" + ipaddress + Constants.requestUrl + "Host=" + host + "&Database=" + database + "&Contact=" + contact + "&Request=Lqr9fy";
string vidcontentType = "application/json";
JObject vidjson = new JObject
{
{ "CAFNo", crcafNo },
{ "CAFDate", crcafDate },
{ "Video", crVideoData }
};
HttpClient vidclient = new HttpClient();
var vidresponse = await vidclient.PostAsync(vidlink, new StringContent(vidjson.ToString(), Encoding.UTF8, vidcontentType));
if (vidresponse.IsSuccessStatusCode)
{
await conn.QueryAsync<CAFTable>("UPDATE tblCaf SET LastSync = ? WHERE CAFNo = ?", DateTime.Parse(current_datetime), crcafNo);
}
}
else
{
await conn.QueryAsync<CAFTable>("UPDATE tblCaf SET LastSync = ? WHERE CAFNo = ?", DateTime.Parse(current_datetime), crcafNo);
}
}
catch(Exception ex)
{
Crashes.TrackError(ex);
}
If your are saving the uploaded video in server using api, May be your max request length smaller than your uploded video size. If you want to upload high size video, Then increase the max request length in your webconfig file. Here is the sample code for increasing max request lenght in web api project.
<httpRuntime targetFramework="4.5.2" maxRequestLength="15200" />

Problem with select in async raw query to a Sqlitie DB in Xamarin C#

Using ExecuteAsync works for create, insert, etc., but not for select.
This are the two queries that works: CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z) and insert into t(y, z) values(2, 2)
But select doesn't. This is my code:
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(App.Databaselocation);
var result = await conn.ExecuteAsync("select y from t");
And throws this SQLiteException:
"SQLite.SQLiteException: Row\n at
SQLite.SQLiteCommand.ExecuteNonQuery () [0x000ad] in
/Users/vagrant/git/src/SQLite.cs:2334 \n at
SQLite.SQLiteConnection.Execute (System.String query, System.Object[]
args) [0x0003a] in /Users/vagrant/git/src/SQLite.cs:673 \n at
SQLite.SQLiteAsyncConnection+<>c__DisplayClass21_0.b__0
() [0x00013] in /Users/vagrant/git/src/SQLiteAsync.cs:222 \n at
System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x0000f] in
<f32579baafc1404fa37ba3ec1abdc0bd>:0 \n at
System.Threading.Tasks.Task.Execute () [0x00010] in
<f32579baafc1404fa37ba3ec1abdc0bd>:0 \n--- End of stack trace from
previous location where exception was thrown ---\n at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 \n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
(System.Threading.Tasks.Task task) [0x0003e] in
<f32579baafc1404fa37ba3ec1abdc0bd>:0 \n at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
(System.Threading.Tasks.Task task) [0x00028] in
<f32579baafc1404fa37ba3ec1abdc0bd>:0 \n at
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
(System.Threading.Tasks.Task task) [0x00008] in
<f32579baafc1404fa37ba3ec1abdc0bd>:0 \n at
System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult ()
[0x00000] in :0 \n at
Byou.PoblacionPage+d__1.MoveNext
() [0x00044] in
C:\Users\sgmon\OneDrive\Projects\Mars\Pob.xaml.cs:41
"
You need to use a Query/QueryAsync in order to return a result set from a sql select:
var result = await conn.QueryAsync<t>("select y from t");

AWS Cognito signup

I'm trying to follow the example for signing up a user in Cognito using C# from here. I had to add some stuff because AmazonCognitoIdentityProviderClient doesn't have an empty constructor. My app happens to be a Xamarin Forms app, but that shouldn't matter. I tried doing it in a .NETStandard project but kept getting an error saying that the method doesn't exist. So I switched to a PCL and now I'm getting System.IO.InvalidDataException: Cannot determine protocol. I get this error on both Android and iOS.
Here is my code:
public async Task SignupUser(string username, string password, string email)
{
const string UserPoolId = "us-east-1_XXXXXXXXX";
const string ClientId = "6xxxxxxxxxxxxxxxxxxxxxxxxx";
const string ClientSecret = "my-client-secret";
const string CognitoIdentityPoolId = "us-east-1:identity-pool-id-here";
try
{
AmazonCognitoIdentityProviderConfig providerConfig = new AmazonCognitoIdentityProviderConfig()
{
RegionEndpoint = RegionEndpoint.USEast1
};
CognitoAWSCredentials cogCreds = new CognitoAWSCredentials(CognitoIdentityPoolId, RegionEndpoint.USEast1);
IdentityProvider = new AmazonCognitoIdentityProviderClient(cogCreds, RegionEndpoint.USEast1);
SignUpRequest signUpRequest = new SignUpRequest()
{
ClientId = ClientId,
Password = password,
Username = username
};
AttributeType emailAttribute = new AttributeType()
{
Name = "email",
Value = email
};
signUpRequest.UserAttributes.Add(emailAttribute);
var signUpResult = await IdentityProvider.SignUpAsync(signUpRequest);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
Here is the exception:
System.IO.InvalidDataException: Cannot determine protocol
at Amazon.Runtime.Internal.Signer.SignRequest (Amazon.Runtime.IRequestContext requestContext) [0x0007a] in <e08989525980425e9b2f389f7417830e>:0
at Amazon.Runtime.Internal.Signer.PreInvoke (Amazon.Runtime.IExecutionContext executionContext) [0x00013] in <e08989525980425e9b2f389f7417830e>:0
at Amazon.Runtime.Internal.Signer.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <e08989525980425e9b2f389f7417830e>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <e08989525980425e9b2f389f7417830e>:0
at Amazon.Runtime.Internal.CredentialsRetriever.<>n__0[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <e08989525980425e9b2f389f7417830e>:0
at Amazon.Runtime.Internal.CredentialsRetriever+<InvokeAsync>d__7`1[T].MoveNext () [0x00103] in <e08989525980425e9b2f389f7417830e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
at Amazon.Runtime.Internal.RetryHandler+<InvokeAsync>d__10`1[T].MoveNext () [0x000b0] in <e08989525980425e9b2f389f7417830e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at Amazon.Runtime.Internal.RetryHandler+<InvokeAsync>d__10`1[T].MoveNext () [0x001b0] in <e08989525980425e9b2f389f7417830e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
at Amazon.Runtime.Internal.CallbackHandler+<InvokeAsync>d__9`1[T].MoveNext () [0x00080] in <e08989525980425e9b2f389f7417830e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
at Amazon.Runtime.Internal.CallbackHandler+<InvokeAsync>d__9`1[T].MoveNext () [0x00080] in <e08989525980425e9b2f389f7417830e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
at Amazon.Runtime.Internal.ErrorCallbackHandler+<InvokeAsync>d__5`1[T].MoveNext () [0x00099] in <e08989525980425e9b2f389f7417830e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
at Amazon.Runtime.Internal.MetricsHandler+<InvokeAsync>d__1`1[T].MoveNext () [0x000ab] in <e08989525980425e9b2f389f7417830e>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.4/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
I solved the same issue sending "null" as credentials in AmazonCognitoIdentityProviderClient constructor:
IdentityProvider = new AmazonCognitoIdentityProviderClient(null, RegionEndpoint.USEast1);
I don't know why but it works perfectly after that, no documentation found.
var region = RegionEndpoint.GetBySystemName("us-west-2"); // use the region that you need
IdentityProvider = new AmazonCognitoIdentityProviderClient(null, region);

Xamarin Forms PopAsync crash

I have built a Xamarin forms app with PCL.
The application crashes sometimes on await Navigation.PopAsync();
I have found this https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity, but it's doesn't help
It appears only on android 5.0 and above. I'm using Xamarin.Forms 2.3.3
Here is crash log:
Xamarin caused by: android.runtime.JavaProxyThrowable: System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.AggregateException: One or more errors occurred. ---> Java.Lang.RuntimeException: Can not perform this action after onSaveInstanceState
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00084] in <bd356ef77b9a4127a500b8385b303c4b>:0
at Android.Runtime.JNIEnv.CallIntMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <bc38a7e9ac144e5b8f3cbfa1d1cb295b>:0
at Android.Support.V4.App.FragmentTransactionInvoker.Commit () [0x00033] in <27c17fe440cf491ba8255bcefade6e02>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync (Xamarin.Forms.Page view, System.Boolean animated, System.Boolean removed, System.Boolean popToRoot) [0x0014b] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00021] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00000] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopped (System.Object sender, Xamarin.Forms.Internals.NavigationRequestedEventArgs e) [0x0000e] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.NavigationPage+<Xamarin-Forms-INavigationPageController-PopAsyncInner>d__63.MoveNext () [0x0006e] in <83d3340f3b274d389854ce45f51043f6>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at Xamarin.Forms.NavigationPage+<PopAsync>d__38.MoveNext () [0x001b9] in <83d3340f3b274d389854ce45f51043f6>:0
--- End of inner exception stack trace ---
at Xamarin.Forms.NavigationPage+<>c.<SafePop>b__93_0 (System.Threading.Tasks.Task`1[TResult] t) [0x0000e] in <83d3340f3b274d389854ce45f51043f6>:0
at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00027] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Threading.Tasks.Task.Execute () [0x00016] in <7f637a73ebd0402caa24252e5f30bf7b>:0
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Java.Lang.RuntimeException: Can not perform this action after onSaveInstanceState
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00084] in <bd356ef77b9a4127a500b8385b303c4b>:0
at Android.Runtime.JNIEnv.CallIntMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <bc38a7e9ac144e5b8f3cbfa1d1cb295b>:0
at Android.Support.V4.App.FragmentTransactionInvoker.Commit () [0x00033] in <27c17fe440cf491ba8255bcefade6e02>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync (Xamarin.Forms.Page view, System.Boolean animated, System.Boolean removed, System.Boolean popToRoot) [0x0014b] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00021] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00000] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopped (System.Object sender, Xamarin.Forms.Internals.NavigationRequestedEventArgs e) [0x0000e] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.NavigationPage+<Xamarin-Forms-INavigationPageController-PopAsyncInner>d__63.MoveNext () [0x0006e] in <83d3340f3b274d389854ce45f51043f6>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at Xamarin.Forms.NavigationPage+<PopAsync>d__38.MoveNext () [0x001b9] in <83d3340f3b274d389854ce45f51043f6>:0
--- End of inner exception stack trace ---
at Xamarin.Forms.NavigationPage+<>c.<SafePop>b__93_0 (System.Threading.Tasks.Task`1[TResult] t) [0x0000e] in <83d3340f3b274d389854ce45f51043f6>:0
at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00027] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Threading.Tasks.Task.Execute () [0x00016] in <7f637a73ebd0402caa24252e5f30bf7b>:0
---> (Inner Exception #0) Java.Lang.RuntimeException: Can not perform this action after onSaveInstanceState
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00084] in <bd356ef77b9a4127a500b8385b303c4b>:0
at Android.Runtime.JNIEnv.CallIntMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <bc38a7e9ac144e5b8f3cbfa1d1cb295b>:0
at Android.Support.V4.App.FragmentTransactionInvoker.Commit () [0x00033] in <27c17fe440cf491ba8255bcefade6e02>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync (Xamarin.Forms.Page view, System.Boolean animated, System.Boolean removed, System.Boolean popToRoot) [0x0014b] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00021] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00000] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopped (System.Object sender, Xamarin.Forms.Internals.NavigationRequestedEventArgs e) [0x0000e] in <651b788f2205433c9db3a98957b5b8aa>:0
at Xamarin.Forms.NavigationPage+<Xamarin-Forms-INavigationPageController-PopAsyncInner>d__63.MoveNext () [0x0006e] in <83d3340f3b274d389854ce45f51043f6>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <7f637a73ebd0402caa24252e5f30bf7b>:0
at Xamarin.Forms.NavigationPage+<PopAsync>d__38.MoveNext () [0x001b9] in <83d3340f3b274d389854ce45f51043f6>:0
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1493)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1511)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:638)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:617)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.n_onBackPressed(Native Method)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.onBackPressed(FormsAppCompatActivity.java:40)
at android.app.Activity.onKeyUp(Activity.java:2713)
at android.view.KeyEvent.dispatch(KeyEvent.java:3280)
at android.app.Activity.dispatchKeyEvent(Activity.java:2983)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:524)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:50)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:241)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:50)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2689)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5233)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5186)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4633)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4686)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4652)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4794)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4660)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4851)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4633)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4686)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4652)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4660)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4633)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4686)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4652)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4827)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5070)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2877)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2449)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2440)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2854)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:7230)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Because the FormsAppCompatActivity
didn't allow your code to manipulate the page diplaying...
That's all. I've searched a lot, and no choice for this moment. Maybe it's a bug, anyway we had right of Push, so would that. But it wouldn't.
Solution I choosed was:
find out the target page from the history
remove it from the NavigationStack, in order to push it back to the top of the NavigationStack
then I could cut off the wanted pages of the NavigationStack
The first row is saying your task crashed so your app crashed. Adding this class
public static class LogException
{
public static void LogExceptions(this Task task)
{
task.ContinueWith(t =>
{
var aggException = t.Exception.Flatten();
foreach (var exception in aggException.InnerExceptions)
{
System.Diagnostics.Debug.WriteLine("LOG EXCEPTION catch: " + exception);
}
},
TaskContinuationOptions.OnlyOnFaulted);
}
}
and using it like this:
Task.Factory.StartNew(() => PopYourPage()).LogExceptions();
would catch these exceptions not killing your app.
What are you popping, can you explain it better?

The "CollectBundleResources" task failed unexpectedly

I'm newbie to learn xamarin. When i download sample and build but I got error
Severity Code Description Project File Line Suppression State
Error The "CollectBundleResources" task failed unexpectedly.
Xamarin.Messaging.Exceptions.MessagingRemoteException: An error occured on client Build403214 while executing a reply for topic xvs/Build/4.0.3.214/copy-item/SamplyGameiOS/25940bb/CoreData.pak ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/niennguyen/Library/Caches/Xamarin/mtbs/builds/SamplyGameiOS/25940bb6fa00542affd423f61b9739d0/D:/SamplyGame/packages/UrhoSharp.1.0.410/build/Xamarin.iOS10/../../native"
at System.IO.Directory.CreateDirectoriesInternal (System.String path) <0x19fb700 + 0x00148> in <filename unknown>:0
at System.IO.Directory.CreateDirectory (System.String path) <0x19fb4f0 + 0x000c7> in <filename unknown>:0
at Xamarin.Messaging.Build.Handlers.CopyItemMessageHandler+<>c__DisplayClass1_0.<ExecuteAsync>b__0 () <0x33203b8 + 0x000b7> in <filename unknown>:0
at System.Threading.Tasks.Task.InnerInvoke () <0x1935f30 + 0x00051> in <filename unknown>:0
at System.Threading.Tasks.Task.Execute () <0x1935780 + 0x0004d> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x188f5d0 + 0x00035> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x188cf00 + 0x000b7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x188ce60 + 0x00087> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x188ce10 + 0x0003f> in <filename unknown>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () <0x188d3c0 + 0x0001f> in <filename unknown>:0
at Xamarin.Messaging.Build.Handlers.CopyItemMessageHandler+<ExecuteAsync>d__1.MoveNext () <0x3320000 + 0x00253> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x188f5d0 + 0x00035> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x188cf00 + 0x000b7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x188ce60 + 0x00087> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x188ce10 + 0x0003f> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x188cde0 + 0x0001f> in <filename unknown>:0
at Xamarin.Messaging.Client.RequestHandler`1+<HandleAsync>d__5[TMessage].MoveNext () <0x331f780 + 0x0035b> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x188f5d0 + 0x00035> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x188cf00 + 0x000b7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x188ce60 + 0x00087> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x188ce10 + 0x0003f> in <filename unknown>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () <0x188d3c0 + 0x0001f> in <filename unknown>:0
at Xamarin.Messaging.Client.MessageHandlerManager+<>c__DisplayClass17_1`1+<<RegisterHandlerAsync>b__3>d[TMessage].MoveNext () <0x331f110 + 0x00257> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x188f5d0 + 0x00035> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x188cf00 + 0x000b7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x188ce60 + 0x00087> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x188ce10 + 0x0003f> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x188cde0 + 0x0001f> in <filename unknown>:0
at Xamarin.Messaging.Client.MessagingClient+<>c__DisplayClass36_0`1+<<ReplyAsync>b__0>d[TRequest].MoveNext () <0x331eba0 + 0x0011b> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x188f5d0 + 0x00035> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x188cf00 + 0x000b7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x188ce60 + 0x00087> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x188ce10 + 0x0003f> in <filename unknown>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () <0x188d600 + 0x00024> in <filename unknown>:0
at Xamarin.Messaging.Client.MessagingClient+<ReplyAsync>d__34`2[TRequest,TResponse].MoveNext () <0x31f70e0 + 0x00383> in <filename unknown>:0
--- End of inner exception stack trace ---
at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__23`2.MoveNext() in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 188
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__22`2.MoveNext() in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__26`2.MoveNext() in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__32`1.MoveNext() in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 306
--- End of stack trace from previous location where exception was thrown ---
at Xamarin.Messaging.Client.IMessagingClientExtensions.Execute(Action postAction) in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Messaging\Xamarin.Messaging.Client\Extensions\IMessagingClientExtensions.cs:line 231
at Xamarin.Messaging.Client.IMessagingClientExtensions.Post[TRequest](IMessagingClient client, TRequest request, Boolean retain, Int32 timeoutSecs) in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Messaging\Xamarin.Messaging.Client\Extensions\IMessagingClientExtensions.cs:line 195
at Xamarin.VisualStudio.Build.BuildClient.UploadItem(String path) in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 99
at Xamarin.VisualStudio.Build.TaskRunner.CopyRequiredInputFiles(Task task) in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 219
at Xamarin.MacDev.Tasks.CollectBundleResources.Execute() in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\MSBuild\Xamarin.MacDev.Tasks\Tasks\CollectBundleResources.cs:line 14
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() SamplyGame.iOS

Categories

Resources