When I do the following test
var contentRes = res as OkNegotiatedContentResult<List<MachineHealthTableDTO>>;
contentRes.Should().NotBeNull();
I get the error
The call is ambiguous between the following methods or properties: 'DataRowAssertionExtensions.Should<TDataRow>(TDataRow)' and 'DataSetAssertionExtensions.Should<TDataSet>(TDataSet)'
This started happening when I upgraded from fluent assertions 5 to 6. Any Idea as to how I can go about resolving this issue would be appreciated.
I've just had this exact issue with a .NET Framework 4.8 console app. Would build fine locally but failed the build step in the Azure DevOps pipeline.
Turns out that pipeline was using the vs2017-win2016
vm. Bumping it up to windows-2019
- which used Visual Studio 2019/later version of MSBuild - sorted the issue.
The question has already been answered, but I had this same error message and could not understand why FluentAssertions had made so many changes from 4 to 6 version. Turned out, I had multiple versions of the Nuget package installed. So check via "Manage nuget packages" for solution, if you have multiple versions of the Fluent Assertions nuget package installed. See the consolidate tab in Visual Studio.
I had a very similar issue with an enum
actualEnumValue.Should().Be(expectedEnumValue);
with the error
Error CS0121 The call is ambiguous between the following methods or properties: 'DataRowAssertionExtensions.Should(TDataRow)' and 'DataSetAssertionExtensions.Should(TDataSet)'
I finally managed to solve the issue by removing <LangVersion>7</LangVersion>
from the project file.
As a quickfix for the failing build I changed the extension method to
AssertionExtensions.Should(contentRes).NotBeNull();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With