libgit2 / libgit2/libgit2sharp
Repository.Discover() throws exception in Release mode, but not Debug mode
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 3.5k
- Fork
- 925
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il problema in modalità Release del comando dell’estensione Visual Studio, usando Repository.Discover(filePath) con il file sorgente LLVM attivo. Ispeziona l’inizializzatore del tipo NativeMethods e confronta il comportamento di Release e Debug su Windows 11 con .NET Framework 4.8. Il lavoro è completato quando Repository.Discover restituisce il percorso del repository nella build Release senza generare eccezioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, git
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100