Closed dradovic closed 3 years ago
I want to add that I was never able to reproduce this issue in complete isolation. Even in the CI. It occurs only sporadically, when all tests run (many of them in parallel). However, there's only one test that uses the LibGit2Sharp nuget.
So I'm wondering what (race) conditions might cause that library not to be found.
I've also compared the build output directories of a successful with a failed run, and in both cases I see the libgit2-8a0dc67.*
files in the same runtimes
subfolders. So the building is consistent. It's definitely a runtime problem.
Hello!
We got the same error (with different sha) in a Lambda function recently.
Found the that it didn't like the linux-x64
version of the libgit2-*.so
dotnet publish provided.
To mitigate, the libgit2-*.so
for runtime rhel-x64
was copied and put alongside the project files.
Then added that libgit2-*.so
to be copied to output directory in the *.csproj
.
Here's an example to reproduce the issue. It includes the "fix" described.
Hope that can help some! 😃
I've found the what was causing the instability of our CI: it seems the culprit was a test that was using the Buildalyzer.Workspaces package (v3.2.3) which in turn uses Roslyn (Microsoft.CodeAnalysis.CSharp.Workspaces) to compute certain code statistics. Once I had deactivated that test, the problem never appeared again.
Reproduction steps
We sporadically experience the following exception in our Bitbucket CI environment, when a test tries to use the LibGit2Sharp library:
Version of LibGit2Sharp (release number or SHA1)
<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0119" />
Operating system(s) tested; .NET runtime tested
The tests are running against the
mcr.microsoft.com/dotnet/sdk:5.0.202
image.