Closed epNickColeman closed 3 years ago
The following prints true for me in .NET Core 3.
using System;
namespace System.Runtime.CompilerServices
{
class IsExternalInit { }
}
namespace ConsoleApp3
{
record Person(string A, string B);
class Program
{
static void Main(string[] args)
{
var a = new Person("a", "b");
var b = new Person("a", "b");
Console.WriteLine(a == b);
}
}
}
Ah, I see it works when targeting 3.1, but using the .net 5.0.300 SDK. I had the following global.json
{
"sdk": {
"version": "3.1.300",
"rollForward": "latestFeature"
}
}
which means it was built with 3.1.403 version of the compiler - so I guess this is we can use the 5.0 SDK to target 3.1 while still necessary, so this can probably be closed. Thanks for taking the time to look at this.
C# 9 was shipped with .NET 5. Are you sure you can compile C# 9 with 3.1 SDK?
Version Used: .Net 3.1.403 C# 9.0
Steps to Reproduce:
Expected Behavior: I expect == to be overridden regardless of framework version Actual Behavior: == is not overridden in .net core3