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

Đang mở
#581 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
devtools, testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
185
Fork
12
Merge trung bình
7 giờ 33 phút
Pull request đã merge (30 ngày)
63

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Nimblesite/SharpLsp

Tất cả issue của Nimblesite/SharpLsp

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.