Skip to content

[Bug] The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception #2542

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

Closed
curicm opened this issue Jan 14, 2021 · 6 comments
Labels

Comments

@curicm
Copy link

curicm commented Jan 14, 2021

Describe the bug
Running out of ideas on this issue:
Error is thrown: "The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception." with no further information
Error only shows on Windows Datacenter 2019, but same commit works on another machine (Windows10).

Expected Behavior

pipeline to succeed

Actual Behavior

C:\GitLab-Runner\build_space\comp.Installer>MSBuild comp.Installer.wixproj /p:Configuration=Release /p:Platform=X64
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/14/2021 3:14:19 PM.
Project "C:\GitLab-Runner\build_space\comp.Installer\comp.Installer.wixproj" on node 1 (default targets).
RunGitVersion:
C:\GitLab-Runner\build_space\comp\packages\GitVersion.MsBuild.5.6.3\tools\net48/gitversion.exe C:\GitLab-Runner\build_space\comp
.Installer -output file -outputfile /gitversion.json
The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
C:\GitLab-Runner\build_space\comp\packages\GitVersion.MsBuild.5.6.3\tools\GitVersion.MsBuild.targets(9,9): error MSB3073: The command "C:\GitLab-Runner\build
s\packages\packages\GitVersion.MsBuild.5.6.3\tools\net48/gitversion.exe C:\GitLab-Runner\build_space\comp.Installer -output file
-outputfile /gitversion.json" exited with code 1. [C:\GitLab-Runner\build_space\comp.Installer\comp.Installer.wixproj]
Done Building Project "C:\GitLab-Runner\build_space\comp.Installer\comp.Installer.wixproj" (default targets) -- FAILED.

Build FAILED.

"C:\GitLab-Runner\build_space\comp.Installer\comp.Installer.wixproj" (default target) (1) ->
(RunGitVersion target) ->
C:\GitLab-Runner\build_space\comp\packages\GitVersion.MsBuild.5.6.3\tools\GitVersion.MsBuild.targets(9,9): error MSB3073: The command "C:\GitLab-Runner\bui
lds\packages\packages\GitVersion.MsBuild.5.6.3\tools\net48/gitversion.exe C:\GitLab-Runner\build_space\comp.Installer -output fil
e -outputfile /gitversion.json" exited with code 1. [C:\GitLab-Runner\build_space\comp.Installer\comp.Installer.wixproj]

0 Warning(s)
1 Error(s)

Your Environment

Windows Server 2019 Datacenter, dedicated to GitLab-runner execution.
Visual studio build tools installed.

@curicm curicm added the bug label Jan 14, 2021
@curicm curicm closed this as completed Jan 15, 2021
@curicm
Copy link
Author

curicm commented Jan 15, 2021

reverted to GitVersionTask 5.2.4 which is working fine

@paul-michalik
Copy link

On Ubuntu 18.04 the last version of GitVersion which DOES NOT exhibit this error is 5.3.4. Is there a sane explanation for this behavior?

@asbjornu
Copy link
Member

On Ubuntu 18.04 the last version of GitVersion which DOES NOT exhibit this error is 5.3.4. Is there a sane explanation for this behavior?

@paul-michalik, I can't parse that sentence. Are you using the latest version of GitVersion (which currently is 5.6.10) or version 5.3.4?

@paul-michalik
Copy link

paul-michalik commented Jun 14, 2021

On Ubuntu 18.04 the last version of GitVersion which DOES NOT exhibit this error is 5.3.4. Is there a sane explanation for this behavior?

@paul-michalik, I can't parse that sentence. Are you using the latest version of GitVersion (which currently is 5.6.10) or version 5.3.4?

@asbjornu I am using GitVersion 5.3.4 because this is the latest version which does not fail with The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception on Ubuntu 18.04. All later versions fail.

@paul-michalik
Copy link

@asbjornu I can confirm again, that the current version 5.6.10 does not work on Ubuntu 18.04 with my repository. I installed from https://github.com/GitTools/GitVersion/releases/download/${version}/gitversion-linux-x64-${version}.tar.gz with version=5.6.10 in a fresh ubuntu:18.04 container. When running gitversion in my repo working copy, I get the 'LibGit2Sharp.Core.NativeMethods' threw an exception error. No logs, nothing. The last version which works is 5.3.4 (took me some time to figure this out).

@asbjornu
Copy link
Member

asbjornu commented Jul 6, 2021

Since 5.3.4 LibGit2Sharp has been bumped from 0.27.0-preview-0034 to 0.27.0-preview-0096 (fdc6957), so I can only assume something has changed in it that is causing this.

Also, Ubuntu 18.04 is based on Debian 10 "Buster" which is not supported by LibGit2Sharp as per libgit2/libgit2sharp#1725. I have no idea, but the workaround offered in #1852 (comment) may provide useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants