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
{{ message }}
Repository navigation
Provide a (limited/best-effort) compatibility shim from MsTest 2/3 to MsTest 4 #7293
MsTest 4 is not binary compatible with MsTest 2/3. It appears that a main reason for this incompatibility is the different assembly names (Microsoft.VisualStudio.TestPlatform.TestFramework.dll vs MsTest.Framework.dll), and that the actual API/ABI are the same for the majority of cases.
Background and Motivation
We have a library that wraps/augments MsTest and provides some additional functionalities, and this library is consumed by a large number of microservices (several hundred) each in separate code bases.
We are now trying to upgrade from MsTest 3 to MsTest 4. The distributed nature of our code base means that the upgrade will happen gradually over time. However, we are faced with a situation where, due to this binary incompatibility, we have to use the same version of MsTest in the library and any consuming code base. The only solution seems to be that we have to maintain two versions of our library, one targeting MsTest 3 and another targeting MsTest 4. This is sub-optimal as it complicates our maintenance and upgrade process.
Proposed Feature
I wonder if it's reasonable to provide a compatibility shim in MsTest 4 for MsTest 2/3, perhaps by type forwarding references to the old type to their new equivalents (where possible, in cases where it's not possible, simply fail at runtime). The shim can be provided via a separate NuGet package for consumers who need it and marked clearly to indicate the dangers of such usage.
Similar compatibility shims have been historically provided by MS, for example when making the switch from .NET Framework to .NET Core. It can prove useful for consumers who understand its danger and are willing to accept the risk in exchange for its benefits.
Hello, we will be able to discuss this next week at earliest. The current support policy states only the latest version as supported, but I get your point.
Do you have examples of the shims that were provided and helped you to move from .net framework to .net?
Do you have examples of the shims that were provided and helped you to move from .net framework to .net?
An example is the fact that every .NET Core runtime since .NET Core 1 up to .NET 10 contains a shim mscorlib.dll, whose sole purpose is whenever it gets called, it type forwards everything to System.Private.CoreLib.dll. For the most part, this hides the fact that .NET Framework and .NET Core names this assembly differently, so a .NET Framework library (compiled against mscorlib.dll) has a reasonable chance of working even in a .NET Core application. Unless of course it uses something that is unavailable on .NET Core, in which case a runtime crash occurs.
There are lots of other binary incompatibilities between MSTest v3 and MSTest v4 (assertion API signature changes, TestMethodAttribute API changes, etc). The best action to take for your case is to update the library to use MSTest 4 in a major version bump of the library, and gradually update your codebases to MSTest v4.
Activity
nohwnd commentedon Jan 26, 2026
Hello, we will be able to discuss this next week at earliest. The current support policy states only the latest version as supported, but I get your point.
Do you have examples of the shims that were provided and helped you to move from .net framework to .net?
scharnyw commentedon Jan 26, 2026
Thanks a lot for the reply.
An example is the fact that every .NET Core runtime since .NET Core 1 up to .NET 10 contains a shim
mscorlib.dll, whose sole purpose is whenever it gets called, it type forwards everything toSystem.Private.CoreLib.dll. For the most part, this hides the fact that .NET Framework and .NET Core names this assembly differently, so a .NET Framework library (compiled againstmscorlib.dll) has a reasonable chance of working even in a .NET Core application. Unless of course it uses something that is unavailable on .NET Core, in which case a runtime crash occurs.Youssef1313 commentedon Jan 28, 2026
There are lots of other binary incompatibilities between MSTest v3 and MSTest v4 (assertion API signature changes, TestMethodAttribute API changes, etc). The best action to take for your case is to update the library to use MSTest 4 in a major version bump of the library, and gradually update your codebases to MSTest v4.