You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Program.cs(3,8): error CS0121: The call is ambiguous between the following methods or properties: 'Assert.That(TestDelegate, IResolveConstraint)' and 'Assert.That<TActual>(TActual, IResolveConstraint)'
If you uncomment <LangVersion>9.0</LangVersion> it works.
The breaking change might be expected. The part that is concerning, is we had some unit tests fail at runtime due to a similar issue, where changing LangVersion=9.0 fixed the test failure:
It looks like the lambda expressions in the test may be binding to the generic overload with TDelegate = Func<int> rather than the overload with Action.
dotnet build src/DotNet/DotNet.csproj - will create a .NET SDK in ./bin/dotnet/ and install optional workloads
./bin/dotnet/dotnet test src/Core/tests/UnitTests/Core.UnitTests-net6.csproj -p:LangVersion=10.0
This actually shows 3 test failures, but they all appear to be the same thing. You can drop -p:LangVersion and the problem goes away, because we currently have LangVersion=9.0 in the .csproj file.
Version Used:
Steps to Reproduce:
dotnet build
fails with:<LangVersion>9.0</LangVersion>
it works.The problematic method is NUnit:
We hit this in .NET MAUI here:
dotnet/maui#2369
The breaking change might be expected. The part that is concerning, is we had some unit tests fail at runtime due to a similar issue, where changing
LangVersion=9.0
fixed the test failure:https://github.com/dotnet/maui/blob/f22a61ac027bb115a115a0f493c97ba0c98fa3e8/src/Core/tests/UnitTests/LifecycleEvents/LifecycleEventsTests.cs#L119-L136
I thought it might be worth checking into, thanks!
Expected Behavior:
NUnit
Assert.That(() => { }, Throws.Nothing);
compiles in C# 10?Actual Behavior:
NUnit
Assert.That(() => { }, Throws.Nothing);
doesn't compile under C# 10.The text was updated successfully, but these errors were encountered: