Skip to content

Missing support for Microsoft.Testing.Platform v2 #209

Closed

Description

@Lorilatschki

Describe the bug
We want to switch to Microsoft.Testing.Platform v2 in our projects, but we are getting an error during extension registration. Can you please provide a version which supports Microsoft.Testing.Platform v2.0.0?

  • Test Framework Xunit (xunit.v3.mtp-v2 v3.2.0)
  • .NET project version, sdk version net8.0
  • Command line used (please share the test run command): dotnet run --project test/MyTestProject.csproj -c Release --no-restore --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory ./testresults --report-junit --report-junit-filename test-result.xml
  • OS: Linux and Windows

Expected behavior
The test shall run as expected.

Other details
During testlogger extension registration, we are getting the following exception (because MTP has moved some types to other namesaces e.g. Microsoft.Testing.Platform.Extensions.TestHost.IDataConsumer to Microsoft.Testing.Platform.Extensions.IDataConsumer.

Additional context
This is the stacktrace during test execution:

Unhandled exception. System.TypeLoadException: Could not load type 'Microsoft.Testing.Platform.Extensions.TestHost.IDataConsumer' from assembly 'Microsoft.Testing.Platform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at Spekt.TestReporter.JUnit.JUnitTestReporterExtensions.AddJUnitReportProvider(ITestApplicationBuilder testApplicationBuilder)
   at Spekt.TestReporter.JUnit.TestingPlatformBuilderHook.AddExtensions(ITestApplicationBuilder testApplicationBuilder, String[] args)
   at Siemens.Simatic.Safety.TestCase.TestLogger.Test.Unit.SelfRegisteredExtensions.AddSelfRegisteredExtensions(ITestApplicationBuilder builder, String[] args) in C:\Users\xxx\source\repos\xxx\obj\Release\net8.0\SelfRegisteredExtensions.cs:line 17
   at Xunit.MicrosoftTestingPlatform.TestPlatformTestFramework.RunAsync(String[] args, Action`2 extensionRegistration) in /_/src/common/MicrosoftTestingPlatform/TestPlatformTestFramework.cs:line 258
   at xxx.AutoGenerated.XunitAutoGeneratedEntryPoint.Main(String[] args) in C:\Users\xxx\source\repos\xxx\obj\Release\net8.0\XunitAutoGeneratedEntryPoint.cs:line 13

Activity

  1. SeMuell commented on Nov 24, 2025

    @SeMuell

    Is there any update on this?

  2. Lorilatschki commented on Nov 24, 2025

    @Lorilatschki
    Author

    @SeMuell I have created the PR with the pure upgrade of the version of MTP, but this is not enough. I think, the logger need to do most likely the same as xunit did, provide a different package name since this MTP v2.0.0 breaks compatibility with vstest. This can only be done by any of the maintainer.

  3. Lorilatschki commented on Dec 5, 2025

    @Lorilatschki
    Author

    @codito I saw you are one of the main contributors of that repo. What is your opinion on this?

  4. codito commented on Dec 5, 2025

    @codito
    Contributor

    @Lorilatschki thank you for the PR with initial support. Adding some thoughts below, any feedback is welcome.

    We have to decide between (a) 2+ packages like Xunit mtp-v1/mtp-v2, or (b) a v8.x of this logger which supports MTP v2 only.

    With (a) I'm worried about complexity/validation matrix. There may be breaking changes in V3 of the MTP and our packages will keep increasing 😄 Alternatively, given these loggers are mostly stable/feature complete, we can choose (b) for simplicity with a support matrix like below.

    Earlier to .NET 10

    • v7.x of the logger is supported for VSTest or MTP v1.
    • v8.x for MTP v2.

    .NET 10 or later

    Test platform Test runner Logger version supported
    VSTest VSTest v7.x
    MTP v1 or v2 VSTest Not supported by SDK
    MTP v1 MTP v7.x
    MTP v2 MTP v8.x

    Above is based on a quick read of https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-migration-from-v1-to-v2, hope I didn't miss anything.

    Now if we go with (b), these will be our next steps.

    • Create long term branch for v7.x from master for MTP v1 and VSTest. We may consider porting and doing minor releases here if there's community ask on any feature.
    • Master moves to .NET 10 + MTP v2
    • To merge the current PR, I think we will need to fix the MTP tests, right now test reports are not created.
    • Removal of MTP v1/VSTest from master can be subsequent PRs.
    • We cut a 8.x release.
  5. molostovvs commented on Dec 8, 2025

    @molostovvs

    if someone needs JUnit output for gitlab cicd, there seems to be a workaround using https://github.com/gfoidl/trx2junit

    more context here: thomhurst/TUnit#3985

  6. added a commit that references this issue on Dec 8, 2025
  7. Lorilatschki commented on Dec 12, 2025

    @Lorilatschki
    Author

    This option would be fine for us, since we are switched to MTPv2. But for those who are on MTPv1 because they use the legacy dotnet test, the will not get any further updates via v8. This can only be done if you double up such updates also on the version 7.

  8. Lorilatschki commented on Dec 12, 2025

    @Lorilatschki
    Author

    Great, when do you think you can provide such a version 8.0.0?

  9. codito commented on Dec 19, 2025

    @codito
    Contributor

    @Youssef1313 are there any build time flags to know if the test app is using MTP v1 vs MTP v2? May be something better than looking up the MTP reference in the project during build.

    I'm curious if we could inject two different extension dlls as reference at build time depending MTP v1 vs v2.

  10. codito commented on Dec 21, 2025

    @codito
    Contributor

    Follow up on #209 (comment)

    • 8.x can support both VSTest and MTP v2
    • 7.x will be for MTP v1

    MTP v2 pre-release is available in MyGet feed: https://www.myget.org/feed/spekt/package/nuget/JunitXml.TestLogger

    Kindly test if possible.

  11. Lorilatschki commented on Dec 21, 2025

    @Lorilatschki
    Author

    @codito thanks for the pre release. I am back in office on 07th of January and will verify it latest at the end of this week.

  12. pcf0 commented on Dec 21, 2025

    @pcf0

    Thanks for the pre-release.
    I have tested JunitXml.TestLogger version 8.0.1-pre.492 in my projects in combination with MSTest.Sdk version 4.0.2 and it works without any problems.

    I have tested the following scenarios:

    • locally via dotnet test
    • locally via Visual Studio 2026 test explorer
    • in the Gitlab CI via dotnet test
  13. Lorilatschki commented on Jan 7, 2026

    @Lorilatschki
    Author

    We have tested the pre-release 8.0.1-pre.492 together with xunit.v3.mtp-v2 v3.2.1 and it works as expected. Any plans when you provide a 8.0.x version on nuget.org?

  14. added a commit that references this issue on Jan 9, 2026
    ef9ddb1
  15. codito commented on Jan 9, 2026

    @codito
    Contributor

    Thanks for testing! v8.0.0 of the loggers are now available on NuGet.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions