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
15
TestAssets/TestProjects/DependencyContextFromTool/Program.cs
Normal file
15
TestAssets/TestProjects/DependencyContextFromTool/Program.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace DependencyContextFromTool
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hi!");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue