webmd-health-services / GitAutomation

PowerShell module for libgit2
Apache License 2.0
27 stars 10 forks source link

Does not work in PSCore on macOS #28

Open felixfbecker opened 6 years ago

felixfbecker commented 6 years ago

This seems to be caused by https://github.com/libgit2/libgit2sharp/issues/1583

> Find-GitRepository
WARNING: SSH support is disabled. To enable SSH, please install Git for Windows. GitAutomation uses the version of SSH that ships with Git for Windows.
Exception calling "IsValid" with "1" argument(s): "The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception."
At /Users/felix/.local/share/powershell/Modules/GitAutomation/0.11.0/Functions/Find-GitRepository.ps1:67 char:12
+     while( $Path -and -not [LibGit2Sharp.Repository]::IsValid($Path)  ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : TypeInitializationException

Get-GitRepository : Exception calling ".ctor" with "1" argument(s): "The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception."
At /Users/felix/.local/share/powershell/Modules/GitAutomation/0.11.0/Functions/Find-GitRepository.ps1:81 char:12
+     return Get-GitRepository -RepoRoot $Path
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Write-Error], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Get-GitRepository

An error has occurred that was not properly handled. Additional information is shown below. The PowerShell process will exit.

Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-15e1193': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.RemoveHandle()
   at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()
splatteredbits commented 5 years ago

We can't do this until our underlying build platform, Whiskey also runs on Linux/Mac OS (so we can run our tests against it). We are currently working on that. Once Whiskey is cross-platform, the next time someone on our team is doing work in GitAutomation, we'll get it updated to be cross-platform.