File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Nerdbank.GitVersioning.Tasks Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -80,10 +80,15 @@ internal CustomAssemblyLoader(ContextAwareTask loaderTask)
8080
8181 protected override Assembly Load ( AssemblyName assemblyName )
8282 {
83+ // Always load libgit2sharp in the default context.
84+ // Something about the p/invoke done in that library with its custom marshaler
85+ // doesn't sit well with Core CLR 2.x.
86+ // See https://github.com/AArnott/Nerdbank.GitVersioning/issues/215 and https://github.com/dotnet/coreclr/issues/19654
87+ AssemblyLoadContext preferredContext = assemblyName . Name . Equals ( "libgit2sharp" , StringComparison . OrdinalIgnoreCase ) ? Default : this ;
8388 string assemblyPath = Path . Combine ( this . loaderTask . ManagedDllDirectory , assemblyName . Name ) + ".dll" ;
8489 if ( File . Exists ( assemblyPath ) )
8590 {
86- return LoadFromAssemblyPath ( assemblyPath ) ;
91+ return preferredContext . LoadFromAssemblyPath ( assemblyPath ) ;
8792 }
8893
8994 return Default . LoadFromAssemblyName ( assemblyName ) ;
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ protected override bool ExecuteInner()
247247 }
248248 catch ( ArgumentOutOfRangeException ex )
249249 {
250- Log . LogErrorFromException ( ex ) ;
250+ this . Log . LogErrorFromException ( ex ) ;
251251 return false ;
252252 }
253253 }
You can’t perform that action at this time.
0 commit comments