libgit2 / libgit2/libgit2sharp
Repository.Discover() throws exception in Release mode, but not Debug mode
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'm making a VSIX extension that does Git operations, I ran into this issue while trying to get the corresponding repo for the active document. When testing in the LLVM repo, doing Repository.Discover() on the active file C:\Users\<my_user_name>\source\repos\llvm-project\clang\lib\Format\UnwrappedLineParser.cpp throws in Release mode, but on Debug mode it correctly gets the repository path of C:\Users\<my_user_name>\source\repos\llvm-project\.git\
Reproduction steps
- Create Visual Studio Extension project and add a command, set build to Release mode
- Within the command, get active document with
DTE applicationObject = (DTE)await AsyncServiceProvider.GlobalProvider.GetServiceAsync(typeof(SDTE)); - Get full file path with
var filePath = applicationObject.ActiveDocument.FullName - Call
var repoPath = Repository.Discover(filePath)
Expected behavior
repoPath holds the path of the repository
Actual behavior
Exception is thrown with the message The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
Version of LibGit2Sharp (release number or SHA1)
0.30.0
Operating system(s) tested; .NET runtime tested
Windows 11, .NET Framework 4.8
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 tái hiện lỗi ở chế độ Release từ lệnh của extension Visual Studio, sử dụng Repository.Discover(filePath) với tệp mã nguồn LLVM đang hoạt động. Kiểm tra bộ khởi tạo kiểu của NativeMethods và so sánh hành vi của Release và Debug trên Windows 11 với .NET Framework 4.8. Hoàn tất khi Repository.Discover trả về đường dẫn repository trong bản build Release mà không ném ngoại lệ.
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, git
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 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
- 35/100