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

オープン
#581 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp
領域
devtools, testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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).

主要言語
TypeScript
スター
185
フォーク
12
平均マージ
7時間 33分
マージ済み PR(30日)
63

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Nimblesite/SharpLsp のほかの issue

Nimblesite/SharpLsp の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。