Skip to content

Commit

Permalink
Exclude Microsoft.Extensions.DependencyModel only (#3903)
Browse files Browse the repository at this point in the history
  • Loading branch information
bording authored Dec 19, 2023
1 parent add2b8b commit 961790f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public InstallerEngineAssemblyLoadContext()
var executingAssemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var assemblyPath = Path.Combine(executingAssemblyDirectory, "InstallerEngine", "ServiceControlInstaller.Engine.dll");

resolver = new DependencyResolver(assemblyPath);
resolver = new(assemblyPath);
}

protected override Assembly Load(AssemblyName assemblyName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ public class ModuleAssemblyInitializer : IModuleAssemblyInitializer, IModuleAsse

static Assembly Resolve(AssemblyLoadContext defaultLoadContext, AssemblyName assemblyName)
{
if (assemblyName.Name.Contains("ServiceControlInstaller.Engine"))
// Don't try to use InstallerEngineAssemblyLoadContext to resolve the assembly it has a dependency on
if (assemblyName.Name.Contains("Microsoft.Extensions.DependencyModel"))
{
return installerEngineLoadContext.LoadFromAssemblyName(assemblyName);
return null;
}
else
{
return null;
return installerEngineLoadContext.LoadFromAssemblyName(assemblyName);
}
}
}
Expand Down

0 comments on commit 961790f

Please sign in to comment.