libgit2 / libgit2/libgit2sharp
LibGit2Sharp can't find native assembly under PowerShell Core
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- C#
- Estrelas
- 3.5k
- Forks
- 925
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece localizando a verificação em tempo de execução e a resolução do assembly nativo no código-fonte do LibGit2Sharp. Reproduza a busca no PowerShell Core e no Windows PowerShell e, em seguida, verifique se o assembly nativo é encontrado na pasta lib/win32/xXX em ambos os ambientes. A tarefa estará concluída quando o GitAutomation puder carregar o LibGit2Sharp no PowerShell Core.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp, powershell
- Domínio
- devtools
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100