Skip to content

[v2] Remove all [Obsolete] members #5604

@thomhurst

Description

@thomhurst

Tracking issue for the next major (v2) release: actually delete all currently [Obsolete]-marked public members.

Background

Members listed below were previously deleted in #5384 (shipped in v1.27.0), which broke semver — see #5539. They are being restored (with [Obsolete] reapplied) for the remainder of the v1.x line. The actual deletion must wait until the v2 major version bump so consumers receive proper compile-time signaling.

Members to remove in v2

TUnit.Assertions

  • CountWrapper<TCollection, TItem> class — TUnit.Assertions.Conditions.Wrappers
  • LengthWrapper class — TUnit.Assertions.Conditions.Wrappers
  • CollectionAssertionBase<TCollection, TItem>.HasCount() — replaced by Count()
  • CollectionAssertionBase<TCollection, TItem>.HasCount(int, string?) — replaced by Count().IsEqualTo(n)
  • AssertionExtensions.HasLength(IAssertionSource<string>) — replaced by Length()
  • AssertionExtensions.HasLength(IAssertionSource<string>, int, string?) — replaced by Length().IsEqualTo(n)

TUnit.Core

  • TestBuilderContext.ObjectBag property — replaced by StateBag
  • TestRegisteredContext.ObjectBag property — replaced by StateBag
  • Timing record class — replaced by OpenTelemetry activity spans
  • ITestOutput.Timings property
  • ITestOutput.RecordTiming(Timing) method
  • TestContext explicit-interface implementations of Timings / RecordTiming and the internal _timingsLock field
  • Internal TimingEntry record (no longer needed once public Timing API is gone)

Process at v2 cut

  1. Bump major version to 2.0.0
  2. Delete the members above
  3. Regenerate TUnit.PublicAPI/Tests.*_Library_Has_No_API_Changes.*.verified.txt snapshots
  4. Update XML doc / migration docs to remove references to obsolete APIs
  5. Close this issue and [Bug]: Removal of obsolete members is a breaking change and should cause a semver-major version bump #5539

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingenhancementNew feature or requestv2Deferred to v2 release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions