Closed ghost closed 10 months ago
What is the actual exception error message?
My guess for the problem is that the way you are creating the docker image is resulting in the correct native binaries not being included in the image.
I forgot to mention that the exception's message is the following one: Object reference not set to an instance of an object.
The way I am building the docker image is by taking the complete build directory and copying it into the Docker build using the command COPY
.
I forgot to mention that the exception's message is the following one: Object reference not set to an instance of an object.
Based on that, I would check and see if the way you obtaining the values you're passing into Repository.Clone
is working when you're running from inside your container. Sound like you're passing a null value in.
I've checked the values passed to Repository.Clone
and all of them are valid. This seems to be a strange situation since the same build works correctly on my machine, but once it is Dockerized, it fails.
I tried executing the code on a Linux machine and it seems to be throwing the same exception.
At this point I'd really need more to go on to be able help further. If you could provide a repo that has a sample project that to reproduce the issue, that would be perfect.
In the end it seems it was due to a missing environment variable by my side which didn't full fill the CloneOptions correctly. So there's nothing wrong with libgit2sharp! Sorry for that!
Glad to hear you figured it out!
Reproduction steps
Running the following code within a Docker container:
Repository.Clone(_config["GitDownloader:Repository"], path, _cloneOptions);
Expected behavior
Cloning the specified repository correctly.
Actual behavior
Throws a
LibGit2SharpException
exception whose stack trace is the following one:Version of LibGit2Sharp (release number or SHA1)
0.28.0
Operating system(s) tested; .NET runtime tested
Works properly on MacOS 14.1.1 with .NET 8.0 Doesn't work on mcr.microsoft.com/dotnet/aspnet:8.0 container with .NET 8.0