Skip to content

New Assert.DoesNotContain overloads break compilation if LangVersion=latest is not specified #11022

Description

@avivanoff

Describe the bug

Assert.DoesNotContain overloads introduced in 4.4.0 break compilation when targeting anything but net10.0 if LangVersion=latest is not specified.
The same setup works with 4.3.3.

Version used

4.4.0

Steps To Reproduce

  1. Create MSTest.Sdk project.
  2. Change SDK version to 4.4.0.
  3. Change TargetFramework to net8.0.
  4. Comment out/delete LangVersion from the project.
  5. Build the project.

Expected behavior

Project builds with no error.

Actual behavior

Build is broken:

error CS0121: The call is ambiguous between the following methods or properties: 'Microsoft.VisualStudio.TestTools.UnitTesting.Assert.DoesNotContain<T>(T, System.Collections.Generic.IEnumerable<T>, string?, string, string)' and 'Microsoft.VisualStudio.TestTools.UnitTesting.Assert.DoesNotContain<T>(T, System.Span<T>, string?, string, string)'

Sample project.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/assertionAssert / StringAssert / CollectionAssert APIs.type/regressionRegression from a previous release.

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions