Test discovery fails on .NET 10 SDK for xunit.v3/MTP projects: 'Testing with VSTest target is no longer supported'

Aperta
#581 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
devtools, testing

Direzione di ricerca

Start by tracing SharpLsp’s test discovery path and the related MTP work in #249 and #574. Check how it identifies project capabilities and chooses between VSTest and MTP, including the IsTestingPlatformApplication property and global.json setting described here. Done when supported MTP projects can be discovered through MTP without that setting, while projects that still need VSTest retain the fallback.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Summary

Test Explorer tries to discover xunit.v3 tests through the old VSTest runner, which no longer works for xunit.v3 projects. It should use the new Microsoft.Testing.Platform (dotnet test MTP) runner wherever the project supports it, and fall back to VSTest only for projects that still need it.

On the .NET 10 SDK, Test Explorer can't discover tests in an xunit.v3 test project whose repo has no global.json opting in to Microsoft.Testing.Platform. The discovery path goes through VSTest, so MSBuild errors out, the test tree shows "Test discovery failed — SharpLsp could not enumerate tests for /Tests.csproj", and no tests are listed.

Environment

  • macOS (Darwin 25.6), .NET SDK 10.0.403
  • xunit.v3 4.0.3, xunit.runner.visualstudio 4.0.1, Microsoft.NET.Test.Sdk
  • The test project has OutputType=Exe. The repo has no global.json and no UseMicrosoftTestingPlatformRunner/TestingPlatformDotnetTestSupport properties.

Repro

  1. Create a test project:
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net10.0</TargetFramework>
        <OutputType>Exe</OutputType>
      </PropertyGroup>
      <ItemGroup>
        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="*" />
        <PackageReference Include="xunit.v3" Version="4.0.3" />
        <PackageReference Include="xunit.runner.visualstudio" Version="4.0.1" />
      </ItemGroup>
    </Project>
    
  2. Open the folder in VS Code with SharpLsp and open Test Explorer.

Actual

Test Results output:

Determining projects to restore...
  All projects are up-to-date for restore.
~/.nuget/packages/microsoft.testing.platform.msbuild/2.5.2/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets(395,5): error : Testing with VSTest target is no longer supported by Microsoft.Testing.Platform on .NET 10 SDK and later. If you use dotnet test, you should opt-in to the new dotnet test experience. For more information, see https://aka.ms/dotnet-test-mtp-error [.../Tests.csproj]

The tree shows the "Test discovery failed" node. The SharpLsp output channel logs nothing about the failure, only the routine workspace/diagnostics/* and ping sidecar traffic every 2s.

Expected

SharpLsp should see that the project is an MTP project (because it references Microsoft.Testing.Platform.MSBuild, for example through xunit.v3 or TUnit, or because IsTestingPlatformApplication=true) and discover and run its tests through MTP (<exe> --list-tests / server mode) instead of the VSTest target. This should work whether or not the repo's global.json opts in with "test": { "runner": "Microsoft.Testing.Platform" }. Failing that, the error node should say exactly what to change, and the output channel should log the failure.

Related: #249 (MTP support), #574 (MTP build preflight errors).

Lingua principale
TypeScript
Stelle
185
Fork
12
Merge medio
7h 33m
PR unite (30g)
63

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Nimblesite/SharpLsp

Tutte le issue di Nimblesite/SharpLsp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.