libgit2 / libgit2/libgit2sharp
Repository.Discover() throws exception in Release mode, but not Debug mode
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 3.5k
- Forks
- 925
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den Fehler im Release-Modus über den Befehl der Visual Studio-Erweiterung zu reproduzieren, und verwende dabei Repository.Discover(filePath) mit der aktiven LLVM-Quelldatei. Untersuche den Typinitialisierer von NativeMethods und vergleiche das Verhalten von Release und Debug unter Windows 11 mit .NET Framework 4.8. Als erledigt gilt die Aufgabe, wenn Repository.Discover im Release-Build den Repository-Pfad zurückgibt, ohne eine Ausnahme auszulösen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, git
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100