libgit2 / libgit2/libgit2sharp
LibGit2Sharp can't find native assembly under PowerShell Core
Chưa có ai nhận issue này.
- 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
Mô tả
I maintain a PowerShell module, GitAutomation, that wraps the LibGit2Sharp library. Yesterday, I was trying to get it to run on PowerShell Core. It doesn't seem to work. It is looking for the native git assembly in the LibGit2Sharp.dll assembly's folder instead of the lib/win32/xXX folder, like it does under Windows PowerShell (.NET Framework).
The issue appears to be your check for whether or not you're running under .NET Core. It looks like you're looking for the Mono.Runtime type, which doesn't exist in the version of .NET Core that PowerShell Core is using.
It looks like the current best way to determine if you're running under .NET Core is to use the System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription property, which begins with .NET Framework when running under the .NET Framework and .NET Core when running under .NET Core.
Windows PowerShell:
$ [Runtime.InteropServices.RuntimeInformation]::FrameworkDescription
.NET Framework 4.7.3260.0
$ [Mono.Runtime]
Unable to find type [Mono.Runtime].
At line:1 char:1
+ [Mono.Runtime]
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Mono.Runtime:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
PowerShell Core
$ [Runtime.InteropServices.RuntimeInformation]::FrameworkDescription
.NET Core 4.6.26919.02
$ [Mono.Runtime]
Unable to find type [Mono.Runtime].
At line:1 char:1
+ [Mono.Runtime]
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Mono.Runtime:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
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.
Hướng nghiên cứu
Bắt đầu bằng cách xác định phần kiểm tra runtime và việc phân giải assembly native trong mã nguồn LibGit2Sharp. Tái hiện việc tra cứu trên PowerShell Core và Windows PowerShell, sau đó xác minh rằng assembly native được tìm thấy từ thư mục lib/win32/xXX trong cả hai môi trường. Hoàn tất khi GitAutomation có thể tải LibGit2Sharp trên PowerShell Core.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp, powershell
- Lĩnh vực
- devtools
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100