Skip to content

TestInitialize/TestCleanup methods on base class in other assembly no longer executed as of MSTest v4? #7339

Closed

Description

@drieseng

Describe the bug

We have a shared assembly that defines a few base classes for unit tests (eg. an AAA base class).
This worked fine up to at least version 3.10.4 of MSTest.

Today, we tried upgrading to version 4.0.2 and we learned that the methods on our base classes that are annotated with TestInitializeAttribute and TestCleanupAttribute are no longer executed.

Like I already mentioned, our base classes are in a separate assembly.
I found no mention of this in the v3 to v4 migration guide, but is this an intentional breaking change (similar to what- at one point was changed for AssemblyInitialize)?

If this is not an intentional breaking change, I'd be happy to provide a repro.

Version used

MSTest v4.0.2

Activity

  1. added
    type/regression
    area/fixtures
    area/mstest
    on Feb 3, 2026
  2. removed
    needs/triage
    on Feb 3, 2026
  3. Youssef1313 commented on Feb 4, 2026

    @Youssef1313
    Member

    I'm unable to reproduce this. This project has the setup described in the issue, but init/cleanup of the base class are executed as expected.

    Issue7339.zip

  4. added
    needs/info
    state/cannot-reproduce
    on Feb 4, 2026
  5. drieseng commented on Feb 4, 2026

    @drieseng
    Author

    I'll verify and make a small git repo that you can use to reproduce the issue.

  6. drieseng commented on Feb 4, 2026

    @drieseng
    Author

    Youssef Fahmy (@Youssef1313), we did more research and found out that it was caused by an assembly version mismatch between the version of MSTest that was used by our shared assembly and the version that was used by the actual test project.

    I'm sorry for wasting your time with this!

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

Metadata

Metadata

Labels

area/fixturesarea/mstestneeds/infostate/cannot-reproducetype/regression

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions