OverloadResolutionPriority is ignored
using .NET 9 consider this code
void Main() { var x = new Foo(); x.Test(); } class Foo { [OverloadResolutionPriority(-1)] public void Test() { Console.WriteLine("Test"); } public void Test(int x = 1) { Console.WriteLine("Test with param"); } }
"Test" is printed.
While executing simillar code in VS "Test with param" is printed
using System.Runtime.CompilerServices; public static class Program { private static void Main() { var x = new Foo(); x.Test(); } } class Foo { [OverloadResolutionPriority(-1)] public void Test() { Console.WriteLine("Test"); } public void Test(int x = 1) { Console.WriteLine("Test with param"); } }
This error happens when Enable C#/F# preview features
is checked and not.
Versions:
Comments
C#13/dotnet9 support is wobbly
Fixed in
LINQPad 8.7.x
:LINQPad now supports the latest C# preview features, including the new
field
keyword.It's working now, thanks!