Skip to content

libgit2sharp is not working on latest version of LinqPad #1670

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
augustoproiete opened this issue Mar 16, 2019 · 4 comments
Closed

libgit2sharp is not working on latest version of LinqPad #1670

augustoproiete opened this issue Mar 16, 2019 · 4 comments

Comments

@augustoproiete
Copy link

augustoproiete commented Mar 16, 2019

Reproduction steps

On a new LinqPad query, add the LibGit2Sharp NuGet package, and try to perform any operation using the Repository class, such as a simple check with Repository.IsValid().

e.g.

void Main()
{
	Console.WriteLine(Repository.IsValid(@"C:\Temp\"));
}

Expected behavior

Output True or False depending if C:\Temp is a valid Git repo.

Actual behavior

Exception thrown:

The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.

Unable to load DLL 'git2-572e4d8': The specified module could not be found. (Exception from HRESULT: 0x8007007E | Unable to load DLL 'git2-572e4d8': The specified module could not be found. (Exception from HRESULT: 0x8007007E

image

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

  • Windows 7
  • .NET Framework 4.7.2
  • LinqPad 5.36.03

/cc @albahari

@bording
Copy link
Member

bording commented Mar 17, 2019

What is the latest version of LibGit2Sharp that works?

@augustoproiete
Copy link
Author

@bording Version 0.25.4 works fine

@bording
Copy link
Member

bording commented Mar 17, 2019

@caioproiete The reason you're seeing that is that #1563 changed the behavior around how we find the native binary. We used to modify the PATH environment variable, but now we no longer do that. I believe LINQPad currently modifies the PATH to get native binaries loaded correctly, so that no longer works for LibGit2Sharp.

There is a GlobalSettings.NativeLibraryPath API that you could call to manually set the path to the native binary, but that API currently appends x86 or x64 to whatever is specified, so that doesn't work right now either.

I think we could make some changes here to allow you to pass in the path to LINQPad's on-disk copy of the binary, but in the mean time, you're going to need to stick with 0.25.4 if you want to use it from LINQPad.

@augustoproiete
Copy link
Author

This has been fixed in newer versions of LinqPad and LibGit2Sharp works as expected (at least) on LinqPad v6.10.13 (x64)

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

No branches or pull requests

2 participants