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

C# Test fails #306

Closed
GaryWayneSmith opened this issue Mar 3, 2023 · 2 comments
Closed

C# Test fails #306

GaryWayneSmith opened this issue Mar 3, 2023 · 2 comments
Labels
closing soon .NET Pull requests that update .net code

Comments

@GaryWayneSmith
Copy link

GaryWayneSmith commented Mar 3, 2023

When running the tests on the current download (as of 3-Mar-2023) the TestBuildStringToSign test fails because of the environmental newline in windows. The actual signing process uses \n whereas StringBuilder under Windows uses \n\r.

Here is the fix:

`

    [Fact]
    public void TestBuildStringToSign()
    {
        string expectedCanonicalHash = "foo";
        StringBuilder expectedStringBuilder = new StringBuilder();
        expectedStringBuilder.Append("AWS4-HMAC-SHA256\n");
        expectedStringBuilder.Append(ISOSigningDateTime+"\n");
        expectedStringBuilder.AppendFormat("{0}/{1}/execute-api/aws4_request\n", ISOSigningDate, TestRegion);
        expectedStringBuilder.Append(expectedCanonicalHash);

        string result = awsSignerHelperUnderTest.BuildStringToSign(SigningDate, expectedCanonicalHash, TestRegion);

        Assert.Equal(expectedStringBuilder.ToString(), result);
    }

`
The AppendLine is replaced with Append and a manual \n is added to the end of the line to match the hard-coded signing process.

@rodrifed
Copy link

Hi @GaryWayneSmith,

Thank you for sharing this issue and the recommended fix with us.
It has been transferred to one of our internal teams in order to work on the corresponding changes.

Thank you,
Federico
Selling Partner Developer Services

@rodrifed rodrifed added the .NET Pull requests that update .net code label Jun 12, 2023
Copy link

github-actions bot commented May 9, 2024

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon .NET Pull requests that update .net code
Projects
None yet
Development

No branches or pull requests

2 participants