fix equality issue in DependencyContextLoader (#2379)
When checking if the provided assembly is the Entry Point Assembly, we previously just checked if the AssemblyNames were equal, but it turns out AssemblyName doesn't implement Equals, so it was using Reference Equality, which fails. This change uses Assembly.Equals, which has an Equals implementation that works. Also adds some tests to ensure it's working. This unblocks scenarios where the EntityFramework `dotnet-ef` command was trying to read DependencyContext.Default but receiving a null reference.
This commit is contained in:
parent
3d157d0ec8
commit
803fef6a8b
10 changed files with 260 additions and 96 deletions
|
@ -25,137 +25,146 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
public static readonly dynamic[] Projects = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
Name = "dotnet-dependency-tool-invoker",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-dependency-tool-invoker",
|
||||
IsApplicable = new Func<bool>(() => CurrentPlatform.IsWindows),
|
||||
new
|
||||
{
|
||||
Name = "dotnet-dependency-context-test",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-dependency-context-test",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = true
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "dotnet-desktop-and-portable",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-desktop-and-portable",
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "dotnet-dependency-tool-invoker",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-dependency-tool-invoker",
|
||||
IsApplicable = new Func<bool>(() => CurrentPlatform.IsWindows),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = true
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "dotnet-hello",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = string.Empty,
|
||||
new
|
||||
{
|
||||
Name = "dotnet-desktop-and-portable",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-desktop-and-portable",
|
||||
IsApplicable = new Func<bool>(() => CurrentPlatform.IsWindows),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = true
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "dotnet-hello",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello",
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "dotnet-hello",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = string.Empty,
|
||||
Clean = true
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "dotnet-portable",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-portable",
|
||||
new
|
||||
{
|
||||
Name = "dotnet-hello",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = string.Empty,
|
||||
Clean = true
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.Cli.Utils",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.Cli.Utils",
|
||||
new
|
||||
{
|
||||
Name = "dotnet-portable",
|
||||
IsTool = true,
|
||||
Path = "TestAssets/TestPackages/dotnet-portable",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = string.Empty,
|
||||
Clean = true
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.Cli.Utils",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.Cli.Utils",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.ProjectModel",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.ProjectModel",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.ProjectModel",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.ProjectModel",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.ProjectModel.Loader",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.ProjectModel.Loader",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.ProjectModel.Loader",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.ProjectModel.Loader",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.ProjectModel.Workspaces",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.ProjectModel.Workspaces",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.ProjectModel.Workspaces",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.ProjectModel.Workspaces",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.InternalAbstractions",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.InternalAbstractions",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.InternalAbstractions",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.InternalAbstractions",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.Extensions.DependencyModel",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.Extensions.DependencyModel",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.Extensions.DependencyModel",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.Extensions.DependencyModel",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.Extensions.Testing.Abstractions",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.Extensions.Testing.Abstractions",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.Extensions.Testing.Abstractions",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.Extensions.Testing.Abstractions",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.Compiler.Common",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.Compiler.Common",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.Compiler.Common",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.Compiler.Common",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.Files",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.Files",
|
||||
new
|
||||
{
|
||||
Name = "Microsoft.DotNet.Files",
|
||||
IsTool = true,
|
||||
Path = "src/Microsoft.DotNet.Files",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = false
|
||||
},
|
||||
new
|
||||
{
|
||||
Name = "dotnet-compile-fsc",
|
||||
IsTool = true,
|
||||
Path = "src/dotnet-compile-fsc",
|
||||
new
|
||||
{
|
||||
Name = "dotnet-compile-fsc",
|
||||
IsTool = true,
|
||||
Path = "src/dotnet-compile-fsc",
|
||||
IsApplicable = new Func<bool>(() => true),
|
||||
VersionSuffix = s_testPackageBuildVersionSuffix,
|
||||
Clean = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue