Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type initializer for ChecksumUtils threw an exception (only on iOS in Release mode for an MAUI App) #3689

Closed
1 task done
pbru87 opened this issue Mar 4, 2025 · 8 comments
Labels
bug This issue is a bug. module/sdk-core p0 This issue is the highest priority potential-regression Marking this issue as a potential regression to be checked by team member response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@pbru87
Copy link

pbru87 commented Mar 4, 2025

Describe the bug

We have a MAUI app (for Android and iOS), where users can sign in. Our CIAM provider is AWS Cognito. Users can sign in via email address/password or via Federated Identity (Apple, Google).

That used to work just fine, but when we upgraded our AWS NuGet packages to newer versions, the email/password login seems to work no more. Instead we get the following error message "The type initializer for 'Amazon.Runtime.Internal.Util.ChecksumUtils' threw an exception."

This exception seems to be thrown when we call the following method (probably on StartWithSrpAuthAsync):

internal static async Task<SignInResponse> SignIn(string email, string password)
{
    StatusCode statusCode;
    try
    {
        using var providerClient = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), RegionEndpoint.EUCentral1);
        var userPool = new CognitoUserPool(MainConstants.AWS_USER_POOL_ID, MainConstants.AWS_USER_POOL_CLIENT_ID, providerClient);
        var user = new CognitoUser(email, MainConstants.AWS_USER_POOL_CLIENT_ID, userPool, providerClient);
        var authRequest = new InitiateSrpAuthRequest()
        {
            Password = password
        };

        AuthFlowResponse response = await user.StartWithSrpAuthAsync(authRequest).ConfigureAwait(false);

        var result = new SignInResponse()
        {
            AWSCognitoResponseSignIn = response,
            AccessToken = response.AuthenticationResult.AccessToken,
            StatusCode = new(HttpStatusCode.OK),
        };

        return result;
    }
    catch (Exception ex)
    {
        statusCode = new((int)HttpStatusCode.BadRequest, ex.Message);
        return new() { StatusCode = statusCode };
    }
}

For some reason, that error only occurs in the "Release" version for iOS. - Android is not affected at all. - Works also just fine when called from a simple app like a console application. - In "Debug" mode it also works just fine for iOS. - Therefore, we assume that it might be related to AOT-compatibility and trimming (which seems to be used for iOS releases already, but is somewhat in beta for Android still).

What else?

  • If we switch back to older AWS Nugets, it works again (also in "Release" mode on iOS). It works when we have AWSSDK.Core as a transitive package in version 3.7.304.31 (and versions before that of course). Version 3.7.400.13 seems also to be just fine.
  • At least since AWSSDK.Core version 3.7.402.4 it seems to not work anymore (and throws the exception mentioned above). I also saw that there were indeed some changes made in the ChecksumUtils class "recently".
  • I also follow the AWSSDK's V4 Development Tracker. Because that preview version also addresses AOT-compatibility issues, I also tried the AWSSDK.Core version 4.0.0-preview.8, but that, unfortunately, just throws the same exception.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Sign-in via StartWithSrpAuthAsync method throws no exception (for "Release" mode on iOS), but succeeds and returns a valid AuthFlowResponse (as in previous AWSSDK.Core versions).

Current Behavior

Sign-in via StartWithSrpAuthAsync method throws the following exception (for "Release" mode on iOS): "The type initializer for 'Amazon.Runtime.Internal.Util.ChecksumUtils' threw an exception."

Reproduction Steps

  1. Create an AWS Cognito user pool.
  2. Create a new user in that user pool (and confirm his email address).
  3. Create a new MAUI app, which uses the `StartWithSrpAuthAsync``method for sign-in, and which uses the problematic AWSSDK.Core either as a direct NuGet reference or as a transitive package.
  4. Create a release version of that MAUI app for iOS.
  5. Install the iOS app on your iPhone.
  6. Test the iOS app and its sign-in functionality on your iPhone. On sign-in, the exception will occur.

Possible Solution

Re-check your latest changes in class 'Amazon.Runtime.Internal.Util.ChecksumUtils'. (Current issue might be related to AOT-compatibility and trimming,)

Additional Information/Context

Problem only occurs in "Release" mode on iOS. ("Debug" mode and Android/Linux/Windows not affected).

AWS .NET SDK and/or Package version used

AWSSDK.Core 3.7.402.4 or AWSSDK.Core 4.0.0-preview.8 => Exception occurs with both versions.

Targeted .NET Platform

.NET 9.0

Operating System and version

iOS

@pbru87 pbru87 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 4, 2025
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label Mar 4, 2025
@dscpinheiro
Copy link
Contributor

We did make a change to the checksum functionality recently, but it was only meant to impact S3.

Is there a stack trace you can share? I'm curious on why Cognito would cause the checksum code path to be executed.

@ashishdhingra
Copy link
Contributor

ashishdhingra commented Mar 4, 2025

@pbru87 Good morning. Are you also using the high-level Cognito library https://github.com/aws/aws-sdk-net-extensions-cognito? We compute GetUserPoolSecretHash, but unsure how it would be as a result in Checksum changes in AWS .NET SDK.

Below code works fine on Windows:
.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Amazon.Extensions.CognitoAuthentication" Version="2.5.5" />
    <PackageReference Include="AWSSDK.CognitoIdentity" Version="3.7.402.25" />
    <PackageReference Include="AWSSDK.CognitoIdentityProvider" Version="3.7.407" />
  </ItemGroup>

</Project>

Program.cs

using Amazon.CognitoIdentityProvider;
using Amazon.Extensions.CognitoAuthentication;
using Amazon.Runtime;
using System.Text;

string userPoolId;
string clientId;
string clientSecret;

const int BufferSize = 10000;

Console.SetIn(new StreamReader(Console.OpenStandardInput(), Encoding.UTF8, false, BufferSize));

Console.Write("Enter User Pool ID: ");
userPoolId = Console.ReadLine();
Console.Write("Enter Client ID: ");
clientId = Console.ReadLine();
Console.Write("Enter Client Secret: ");
clientSecret = Console.ReadLine();

bool reexecuteFlow = false;

do
{
    Console.Write("User Name: ");
    string userName = Console.ReadLine();

    while (string.IsNullOrWhiteSpace(userName))
    {
        Console.Write("Please enter a valid User Name: ");
        userName = Console.ReadLine();
    }

    Console.Write("Do you have a Refresh Token (Y/N): ");
    char hasRefreshTokenResponse = Convert.ToChar(Console.ReadLine());
    bool hasRefreshToken = (char.ToLower(hasRefreshTokenResponse) == 'y');
    Console.WriteLine();

    string passwordOrRefreshToken;

    if (!hasRefreshToken)
    {
        Console.Write("Password: ");
        passwordOrRefreshToken = Console.ReadLine();

        while (string.IsNullOrWhiteSpace(passwordOrRefreshToken))
        {
            Console.Write("Please enter a valid Password: ");
            passwordOrRefreshToken = Console.ReadLine();
        }
    }
    else
    {
        Console.Write("Existing Refresh Token: ");
        passwordOrRefreshToken = Console.ReadLine();

        while (string.IsNullOrWhiteSpace(passwordOrRefreshToken))
        {
            Console.Write("Please enter a valid Refresh Token: ");
            passwordOrRefreshToken = Console.ReadLine();
        }
    }

    Console.WriteLine("\nExecuting {0} auth flow.", (hasRefreshToken ? "Refresh Token" : "Username/Password"));
#pragma warning disable CS8604 // Possible null reference argument.
    AuthFlowResponse authFlowResponse = (hasRefreshToken ? GetCredsFromRefreshAsync(userName, passwordOrRefreshToken, userPoolId, clientId, clientSecret).GetAwaiter().GetResult() : GetCredentials(userName, passwordOrRefreshToken, userPoolId, clientId, clientSecret).GetAwaiter().GetResult());
#pragma warning restore CS8604 // Possible null reference argument.
    Console.WriteLine("ID Token: {0}\nAccess Token {1}\nRefresh Token: {2}", authFlowResponse.AuthenticationResult.IdToken, authFlowResponse.AuthenticationResult.AccessToken, authFlowResponse.AuthenticationResult.RefreshToken);

    Console.Write("\n\nRe-execute Flow (Y/N): ");
    char reexecuteFlowResponse = Convert.ToChar(Console.ReadLine());
    reexecuteFlow = (char.ToLower(reexecuteFlowResponse) == 'y');
} while (reexecuteFlow);

static async Task<AuthFlowResponse> GetCredentials(string userName, string password, string userPoolId, string clientId, string clientSecret)
{
    var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), FallbackRegionFactory.GetRegionEndpoint());
    var userPool = new CognitoUserPool(userPoolId, clientId, provider, clientSecret);
    var user = new CognitoUser(userName, clientId, userPool, provider, clientSecret);

    AuthFlowResponse authResponse = await user.StartWithSrpAuthAsync(new InitiateSrpAuthRequest()
    {
        Password = password
    }).ConfigureAwait(false);

    while (authResponse.AuthenticationResult == null)
    {
        if (authResponse.ChallengeName == ChallengeNameType.NEW_PASSWORD_REQUIRED)
        {
            Console.WriteLine("Enter your desired new password: ");
            string newPassword = Console.ReadLine();

            authResponse = await user.RespondToNewPasswordRequiredAsync(new RespondToNewPasswordRequiredRequest()
            {
                SessionID = authResponse.SessionID,
                NewPassword = newPassword
            });
        }
        else if (authResponse.ChallengeName == ChallengeNameType.SMS_MFA)
        {
            Console.WriteLine("Enter the MFA Code sent to your device: ");
            string mfaCode = Console.ReadLine();

            authResponse = await user.RespondToSmsMfaAuthAsync(new RespondToSmsMfaRequest()
            {
                SessionID = authResponse.SessionID,
                MfaCode = mfaCode

            }).ConfigureAwait(false);
        }
        else
        {
            Console.WriteLine("Unrecognized authentication challenge.");
            return null;
        }
    }

    return authResponse;
}

static async Task<AuthFlowResponse> GetCredsFromRefreshAsync(string userName, string refreshToken, string userPoolId, string clientId, string clientSecret)
{
    AmazonCognitoIdentityProviderClient provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), FallbackRegionFactory.GetRegionEndpoint());
    CognitoUserPool userPool = new CognitoUserPool(userPoolId, clientId, provider, clientSecret);

    CognitoUser user = new CognitoUser(userName, clientId, userPool, provider, clientSecret);

    user.SessionTokens = new CognitoUserSession(null, null, refreshToken, DateTime.Now, DateTime.Now.AddHours(1));

    InitiateRefreshTokenAuthRequest refreshRequest = new InitiateRefreshTokenAuthRequest()
    {
        AuthFlowType = AuthFlowType.REFRESH_TOKEN_AUTH
    };

    return await user.StartWithRefreshTokenAuthAsync(refreshRequest).ConfigureAwait(false);
}

As @dscpinheiro requested, please share the stack trace to troubleshoot the issue.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. module/sdk-generated and removed needs-triage This issue or PR still needs to be triaged. labels Mar 4, 2025
@pbru87
Copy link
Author

pbru87 commented Mar 4, 2025

Hi @dscpinheiro, hi @ashishdhingra,

Thanks for your quick replies!

@ashishdhingra: That the code works under Windows and without issues is expected (see my above issue description). Issue is only on iOS (Release mode).

@ashishdhingra: Yes, we also use the NuGet packages AWSSDK.CognitoIdentity and AWSSDK.CognitoIdentityProvider.
Additionally, we also use these packages (because we use other AWS services as well):

  • AWSSDK.SimpleEmail
  • Amazon.Extensions.CognitoAuthentication
  • AWSSDK.DynamoDBv2
  • AWSSDK.S3.

@dscpinheiro, @ashishdhingra: Here comes the StackTrace (for the exception message "TypeInitialization_Type, Amazon.Runtime.Internal.Util.ChecksumUtils")...

at Amazon.Runtime.Internal.Transform.UnmarshallerContext.SetupFlexibleChecksumStream(IWebResponseData , Stream , Int64 , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonUnmarshallerContext..ctor(Stream , Boolean , IWebResponseData , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.ConstructUnmarshallerContext(Stream , Boolean , IWebResponseData , Boolean )
at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.CreateContext(IWebResponseData , Boolean , Stream , RequestMetrics , Boolean , IRequestContext )
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext , IWebResponseData , HttpErrorResponseException , Stream )
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext , HttpErrorResponseException )
at Amazon.Runtime.Internal.ExceptionHandler`1.<HandleAsync>d__6[[Amazon.Runtime.Internal.HttpErrorResponseException, AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext , Exception )
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Signer.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.GetUserResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Transform.UnmarshallerContext.SetupFlexibleChecksumStream(IWebResponseData , Stream , Int64 , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonUnmarshallerContext..ctor(Stream , Boolean , IWebResponseData , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.ConstructUnmarshallerContext(Stream , Boolean , IWebResponseData , Boolean )
at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.CreateContext(IWebResponseData , Boolean , Stream , RequestMetrics , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Unmarshaller.UnmarshallAsync(IExecutionContext )
at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Signer.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Transform.UnmarshallerContext.SetupFlexibleChecksumStream(IWebResponseData , Stream , Int64 , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonUnmarshallerContext..ctor(Stream , Boolean , IWebResponseData , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.ConstructUnmarshallerContext(Stream , Boolean , IWebResponseData , Boolean )
at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.CreateContext(IWebResponseData , Boolean , Stream , RequestMetrics , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Unmarshaller.UnmarshallAsync(IExecutionContext )
at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Signer.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Transform.UnmarshallerContext.SetupFlexibleChecksumStream(IWebResponseData , Stream , Int64 , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonUnmarshallerContext..ctor(Stream , Boolean , IWebResponseData , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.ConstructUnmarshallerContext(Stream , Boolean , IWebResponseData , Boolean )
at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.CreateContext(IWebResponseData , Boolean , Stream , RequestMetrics , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Unmarshaller.UnmarshallAsync(IExecutionContext )
at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Signer.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Extensions.CognitoAuthentication.CognitoUser.StartWithSrpAuthAsync(InitiateSrpAuthRequest srpRequest, CancellationToken cancellationToken)
at Amazon.Extensions.CognitoAuthentication.CognitoUser.StartWithSrpAuthAsync(InitiateSrpAuthRequest srpRequest)
at Amazon.Runtime.Internal.Transform.UnmarshallerContext.SetupFlexibleChecksumStream(IWebResponseData , Stream , Int64 , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonUnmarshallerContext..ctor(Stream , Boolean , IWebResponseData , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.ConstructUnmarshallerContext(Stream , Boolean , IWebResponseData , Boolean )
at Amazon.Runtime.Internal.Transform.ResponseUnmarshaller.CreateContext(IWebResponseData , Boolean , Stream , RequestMetrics , Boolean , IRequestContext )
at Amazon.Runtime.Internal.Unmarshaller.UnmarshallAsync(IExecutionContext )
at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.Signer.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1[[Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, AWSSDK.CognitoIdentityProvider, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
at Amazon.Extensions.CognitoAuthentication.CognitoUser.StartWithSrpAuthAsync(InitiateSrpAuthRequest srpRequest, CancellationToken cancellationToken)
at Amazon.Extensions.CognitoAuthentication.CognitoUser.StartWithSrpAuthAsync(InitiateSrpAuthRequest srpRequest)
at MAUIApp.ViewModels.Login.LoginPasswordPageModel.SignIn(String email, String password)

@dscpinheiro
Copy link
Contributor

Thanks for the stack trace. I suspect the issue is happening because we try to check if the AWS Common Runtime dependency is available:

private readonly static List<CoreChecksumAlgorithm> _responseChecksumsInPriorityOrder = ChecksumCRTWrapper.IsCrtAvailable() ?

We're only checking for AWSCommonRuntimeException (which we throw ourselves) but we've found that the CRT does not work across all environments. We'll update that wrapper not to fail in those scenarios, but for now you'll need to use the old version of the Amazon.Extensions.CognitoAuthentication library.

@pbru87
Copy link
Author

pbru87 commented Mar 4, 2025

@dscpinheiro: Thanks for the feedback! For now it's fine for us to use older versions of the NuGet package (as there is currently no downside to do so) - and we will be very happy when this issue will be addressed in a recent update. 🙂

@dscpinheiro dscpinheiro added p0 This issue is the highest priority and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. module/sdk-generated labels Mar 4, 2025
@dscpinheiro
Copy link
Contributor

@pbru87 Would you be able to try the latest versions of the AWSSDK.CognitoIdentity and AWSSDK.CognitoIdentityProvider packages and see if the problem is resolved? https://www.nuget.org/packages/AWSSDK.CognitoIdentityProvider/3.7.407.2 and https://www.nuget.org/packages/AWSSDK.CognitoIdentity/3.7.402.27

They include an update to the ChecksumUtils class so it better handles use cases where the CRT dependency isn't available.

@dscpinheiro dscpinheiro added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 5, 2025
@pbru87
Copy link
Author

pbru87 commented Mar 6, 2025

@dscpinheiro We tested today with exactly the package versions, you mentioned - and it works again, like a charm 🎉 - Thank you very much for this very fast fix! Much appreciated. 🙂 - As it is fixed, I herebey also close this issue.

@pbru87 pbru87 closed this as completed Mar 6, 2025
Copy link

github-actions bot commented Mar 6, 2025

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. module/sdk-core p0 This issue is the highest priority potential-regression Marking this issue as a potential regression to be checked by team member response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants