question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] No error message has been provided by the native library

See original GitHub issue

Describe the bug Azure Devops Server 2020 self hosted agent clones with shallow-fetch. Therefore I provide the /url parameter for GitVersion which causes the following exception. I tried it with http and https /b /u and /p but the behaviour didn’t change. LibGit2SharpException : No error message has been provided by the native library.

Expected Behavior

GitVersion should clone the repo without exceptions.

Actual Behavior

GitVersion throws exception and doesn’t clone the repository.

Errormessage
  ERROR [10/19/21 15:19:17:44] An unexpected error occurred:
System.Exception: There was an unknown problem with the Git repository you provided
INFO [10/19/21 15:19:17:11] Working directory: C:/agent/_work/607/s
INFO [10/19/21 15:19:17:14] Branch from build environment: refs/heads/feature/GitVersion
 ---> LibGit2Sharp.LibGit2SharpException: No error message has been provided by the native library
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)
   at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
   at GitVersion.GitRepository.Clone(String sourceUrl, String workdirPath, AuthenticationInfo auth) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 167
   --- End of inner exception stack trace ---
   at GitVersion.GitRepository.Clone(String sourceUrl, String workdirPath, AuthenticationInfo auth) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 190
   at GitVersion.GitPreparer.<>c__DisplayClass16_0.<CloneRepository>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 155
   at GitVersion.Helpers.RetryAction`1.<>c__DisplayClass1_0.<Execute>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 18
   at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context ctx, CancellationToken ct)
   at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)
   at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`1 action)
   at GitVersion.Helpers.RetryAction`2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 37
   at GitVersion.Helpers.RetryAction`1.Execute(Action operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 16
   at GitVersion.GitPreparer.CloneRepository(String repositoryUrl, String gitDirectory, AuthenticationInfo auth) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 155
   at GitVersion.GitPreparer.CreateDynamicRepository(String targetBranch) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 132
   at GitVersion.GitPreparer.PrepareInternal(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 67
   at GitVersion.GitPreparer.Prepare() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 59
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 43
   at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs:line 70
INFO [10/19/21 15:19:17:14] Project root is: C:/agent/_work/607/s
INFO [10/19/21 15:19:17:14] DotGit directory is: C:\Users\{user}\AppData\Local\Temp\{repo}\.git
INFO [10/19/21 15:19:17:14] Begin: Creating dynamic repository at 'C:\Users\{user}\AppData\Local\Temp\{repo}\.git'
  INFO [10/19/21 15:19:17:14] Begin: Cloning repository from url '{url}'
  INFO [10/19/21 15:19:17:41] End: Cloning repository from url '{url}' (Took: 268.95ms)
  INFO [10/19/21 15:19:17:41] End: Creating dynamic repository at 'C:\Users\{user}\AppData\Local\Temp\{repo}\.git' (Took: 269.33ms)
  INFO [10/19/21 15:19:17:44] Attempting to show the current git graph (please include in issue): 
  INFO [10/19/21 15:19:17:44] Showing max of 100 commits
  INFO [10/19/21 15:19:17:50] * 2d3b7e7 44 seconds ago  (HEAD, origin/2d3b7e7b4c83d6c884f2afd8ceaddb36f591011e)
* 9b41330 2 minutes ago  (origin/9b413308a30f106bbdebd1ddb485a1bd500d40c9)
* 6beba62 5 minutes ago 
* 7b41ff8 22 minutes ago 
* 95c2a22 22 minutes ago 
* 4588a08 39 minutes ago 
* b183392 48 minutes ago 
* 0ad1727 52 minutes ago 
* 15bb176 54 minutes ago 
* f9f5d62 4 hours ago 
* 684e5ad 4 hours ago 
* 08073f4 4 hours ago 
* 8a001c3 4 hours ago 
* 7ae7f36 4 hours ago 
* 8873dbe 6 hours ago 
* 79cc772 6 hours ago 
* df08d12 6 hours ago 
* 46b4a1a 6 hours ago 
* 2341fa7 6 hours ago 
* 4f749bd 6 hours ago  (grafted)

INFO [10/19/21 15:19:17:07] Applicable build agent found: 'AzurePipelines'.

Possible Fix

After stepping myself through the latest changes in libgit2sharp it seems fixed with this commit https://github.com/libgit2/libgit2sharp/commit/29efc69f0ac78e2b44e64e7de3de6a845e7ec4a7. After pulling this, clone works without throwing exceptions. Unfortunately this commit seems to not be included in any preview release.

Steps to Reproduce

I cloned GitVersion and tested locally. My case works with GitVersion 5.2.0 but not with any version after that. The problem seems to be located in the preview release of libgit2sharp 0.27.0-preview that was included after that release. I cloned lib2gitsharp locally and with the latest changes but it worked without problems.

Context

We create internal nuget packages and want to switch from a date-based versioning to GitVersion. Our git history is huge hence we are shallow fetching on the build agents to save space and time.

Your Environment

Azure Devops Server 2020 hosted git repositories Self hosted windows build agents

  • Version Used: 5.7.0
  • Operating System and version (Windows 10, Ubuntu 18.04): Windows 10
  • Link to your project: private
  • Link to your CI build (if appropriate): private

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
asbjornucommented, Nov 12, 2021

A new version of the AzDO extension shouldn’t be necessary, I think, but version 5.8.0 of GitVersion should be released within the next few days.

1reaction
asbjornucommented, Nov 11, 2021

If a new version of LibGit2Sharp fixes this problem, #2916 should be useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No error message has been provided by the native library
I was able to clone git repository by using the command: git -c http.sslVerify=false clone https://example.com/path/to/git.
Read more >
Git push error - Help
Hi, I get an error when commiting and pushing to my Bitbucket. The error says “No error message has been provided by the...
Read more >
Repository Clone Throws No error message has been ...
am getting No error message has been provided by the native library while cloning. its only happening on the few repos. var path...
Read more >
No error message has been provided by the native library ...
I was able to clone git repository by using the command: git -c http.sslVerify=false clone https://example.com/path/to/git.
Read more >
How to Handle the UnsatisfiedLinkError Runtime Error in ...
The Java java.lang.UnsatisfiedLinkError is thrown when a program uses a native libaray but is unable to find it at runtime for some reason....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found