pinvoke
pinvoke copied to clipboard
Sporadic x64 test failure in NCryptFacts.SignHash
NCryptFacts.SignHash [FAIL]
PInvoke.SecurityStatusException : The parameter is incorrect (SECURITY_STATUS error: NTE_INVALID_PARAMETER (0x80090027))
Stack Trace:
NCrypt\NCryptExtensions.cs(34,0): at PInvoke.NCryptExtensions.ThrowOnError(SECURITY_STATUS status)
NCrypt\NCrypt.Helpers.cs(413,0): at PInvoke.NCrypt.NCryptVerifySignature(SafeKeyHandle key, Void* paddingInfo, Byte[] hashValue, Byte[] signature, NCryptSignHashFlags flags)
NCrypt.Tests\NCryptFacts.cs(154,0): at NCryptFacts.SignHash()
- I can't repro this at will. Only seen it twice now, and only on x64 test runs.
- Running the tests immediately after this failure seems to work out okay and the tests pass.
0x80090027/NTE_INVALID_PARAMETERisn't too helpful otherwise.
Was this running within Test Explorer? Locally with xunit.console.exe? Locally with dotnet test? Or in a PR build that you saw?
I'm running xunit.console.exe in a loop for these ncrypt tests and so far nothing has failed.
I just ran build.ps1 -Test or a variant of it (like build.ps1 -Build -Test) when I encountered the original error.
I had trouble reproducing it as well, but I was eventually able to repro it today with some effort. It's still roughly at a < 1% repro-rate (so this might eventually inform how much effort goes into root-causing and/or fixing the problem).
I wrote a test-runner to run NCrypt.Tests in parallel several (~100~ 200) times (it's a script based off of build.ps1), and I'm generally seeing a repro rate of about 1 iteration (out of ~100~ 200) reproducing this problem. The script is at https://github.com/vatsan-madhavan/pinvoke/blob/8ebdeefb93ae49e47cf9dfdaa1492f211b7132e9/run-ncrypt-tests.ps1. After building a Debug configuration of the repo, just run the script from powershell and it should launch NCrypt.Tests ~100~ 200 times.
Here is what a failing log looks like: testresults30.zip