libgit2 / libgit2/libgit2sharp
LibGit2Sharp can't find native assembly under PowerShell Core
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 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
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, die Laufzeitprüfung und die Auflösung der nativen Assembly im LibGit2Sharp-Quellcode zu finden. Führe die Suche unter PowerShell Core und Windows PowerShell erneut durch und überprüfe anschließend, dass die native Assembly in beiden Umgebungen aus dem Ordner lib/win32/xXX gefunden wird. Als erledigt gilt die Aufgabe, wenn GitAutomation LibGit2Sharp unter PowerShell Core laden kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, powershell
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100