Failed to load native git library inside a powershell module
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Tái hiện lỗi từ LibGit2SharpMiniProject được liên kết bằng cách khởi chạy với launchSettings.json và chạy Test-SampleCmdlet. Bắt đầu với NativeMethods.InitializeNativeLibrary trong NativeMethods.cs ở dòng 148 và đường dẫn tải module PowerShell, sau đó xác minh rằng thư viện native chính xác cùng các dependency của nó được tải trong module giống như trong ứng dụng console.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I made a class library that uses LibGit2Sharp to perform some actions on a repository.
This class library is loaded in a console app with no problem
I'm trying to create a powershell module that uses the same class library but it seems to fails to load the git native library
I'm not too sure if the issue is coming from a badly configured project or if it's just the powershell module that fails to automatically bind the proper native dll
I get the following exception:
The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
Stack trace:
at LibGit2Sharp.Core.NativeMethods.git_repository_open(git_repository*& repository, FilePath path)
at LibGit2Sharp.Core.Proxy.git_repository_open(String path) in //LibGit2Sharp/Core/Proxy.cs:line 2552
at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter) in //LibGit2Sharp/Repository.cs:line 159
at LibGit2Sharp.Repository..ctor(String path) in /_/LibGit2Sharp/Repository.cs:line 70
at ClassLibrary.Class1.Init(String path) in D:\dev\Perso\ClassLibrary\Class1.cs:line 11
at MyModule.TestSampleCmdletCommand.ProcessRecord() in D:\dev\Perso\MyModule\TestSampleCmdletCommand.cs:line 14
at System.Management.Automation.CommandProcessor.ProcessRecord() in System.Management.Automation\CommandProcessor.cs:line 200
InnerException:
Unable to load DLL 'git2-a418d9d' or one of its dependencies: The specified module could not be found. (0x8007007E)
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary() in //LibGit2Sharp/Core/NativeMethods.cs:line 148
at LibGit2Sharp.Core.NativeMethods..cctor() in //LibGit2Sharp/Core/NativeMethods.cs:line 54
Reproduction steps
LibGit2SharpMiniProject.zip
https://github.com/NephChevsky/LibGit2SharpMiniProject
I created a simple project to reproduce this issue
Just launch the project with the launchSettings.json configuration and type the command: "Test-SampleCmdlet"
Expected behavior
Should find and load the right native library properly
Actual behavior
Could not load native library git2-a418d9d.dll
Version of LibGit2Sharp (release number or SHA1)
0.30.0
Operating system(s) tested; .NET runtime tested
net8
Windows 11 Professional
- Ngôn ngữ chính
- C#
- Star
- 3.5k
- Fork
- 925
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của libgit2/libgit2sharp
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
libgit2/libgit2sharp#2193 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
libgit2/libgit2sharp#2192 · 1 bình luận ·
-
Website is down Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
libgit2/libgit2sharp#2191 · 2 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
libgit2/libgit2sharp#2189 · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
libgit2/libgit2sharp#2187 · 2 bình luận ·
Tất cả issue của libgit2/libgit2sharp
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
azurenoops/spin_agent#975 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SubtitleEdit/subtitleedit#15108 · 1 bình luận ·