Skip to content

C# Dev Kit reports discovery aborted after VSTest successfully discovers 423 tests #3723

Open
microsoft/vstest
#16636

Description

C# Dev Kit reports "The active Tests Discovery was aborted." and does not run the selected tests, even though the underlying VSTest diagnostic log records successful discovery of 423 test cases, including 80 cases from the active test class. The test host exits with code 0.

Note that the failure to discover tests appears to happen both with "dotnet.testWindow.discoverTestsFromSource": true as well as false. The below logs were taken with false.

The same project runs tests successfully via dotnet test.

Environment

  • OS: Ubuntu 24.04.
  • Repository: dotnet/roslyn@65d3499.
  • C# Dev Kit: 11.7.51 (reported in Test Explorer log).
  • C# extension: installed path identifies version 11.5.15-linux-x64.
  • SDK used by Dev Kit's VSTest process: 11.0.100-rc.1.26425.128.
  • SDK selected by dotnet --version in the repository: 11.0.100-rc.1.26425.128.
  • Test target framework: net10.0.
  • xUnit VSTest adapter: v3.1.3+b1b99bdeb3.
  • Test-host runtime reported by adapter: 64-bit .NET 10.0.11.
  • Dev Kit reports TestingPlatform: False / MTP: False.
  • No runsettings path configured, according to the discovery log.
  • Project: src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Microsoft.CodeAnalysis.LanguageServer.UnitTests.csproj.
  • Active file: src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/MiscellaneousFiles/FileBasedProgramsWorkspaceTests.cs.

Expected and actual behavior

Expected: Successfully discovered test cases appear in Test Explorer and the selected tests run.

Actual: After a successful build and xUnit discovery, Dev Kit reports discovery aborted, followed by "No safely selected tests ... nothing to run."

Chronological evidence

These excerpts cover one build/discovery/run-selection attempt on October 26, 2026. Timestamps below are local time (UTC-07:00). Excerpts from the two sources are interleaved chronologically. Log text is preserved, except that the large JSON completion payload is explicitly projected below.

1. 14:36:06.955-14:36:06.963: Build finishes; Dev Kit starts discovery

Source: A, lines 55-63.

2026-10-26 14:36:06.955 [debug] 🔵 Completed Task [Build 1 projects]
2026-10-26 14:36:06.956 [info] 🔵 Re-discovering 'Microsoft.CodeAnalysis.LanguageServer.UnitTests' after build to reconcile test cases.
2026-10-26 14:36:06.959 [debug] 🔵 discoverTestsInProject: 'Microsoft.CodeAnalysis.LanguageServer.UnitTests'
2026-10-26 14:36:06.959 [debug] 🔵 No runSettingsPath configured. Falling back to default settings.
2026-10-26 14:36:06.960 [info] 🟣 Discovering tests in project '/home/rigibson/src/roslyn/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Microsoft.CodeAnalysis.LanguageServer.UnitTests.csproj' (TestingPlatform: False)
2026-10-26 14:36:06.960 [info] 🟣 Discovery: /home/rigibson/src/roslyn/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Debug/net10.0/Microsoft.CodeAnalysis.LanguageServer.UnitTests.dll (MTP: False)
2026-10-26 14:36:06.961 [info] 🟣 Logging Test Platform diagnostic logs under '/tmp/TestPlatformLogs/2026_10_26_14_36_06_29969'
2026-10-26 14:36:06.962 [info] 🟣 VsTest: testConsolePath=/home/rigibson/.local/share/dotnetup/dotnet/sdk/11.0.100-rc.1.26425.128/vstest.console.dll, inheritEnv=False, envCount=85, DOTNET_ROOT=/home/rigibson/.local/share/dotnetup/dotnet, DOTNET_HOST_PATH=/home/rigibson/.local/share/dotnetup/dotnet/dotnet
2026-10-26 14:36:06.963 [info] 🟣 VsTest: session started successfully

2. 14:36:07.303-14:36:07.580: xUnit reports successful discovery

Source: A, lines 64-67.

2026-10-26 14:36:07.303 [info] 🟣 Logging TestHost Diagnostics in file: /tmp/TestPlatformLogs/2026_10_26_14_36_06_29969/logs.host.26-10-26_14-36-07_13825_6.txt
2026-10-26 14:36:07.401 [info] 🟣 [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.3+b1b99bdeb3 (64-bit .NET 10.0.11)
2026-10-26 14:36:07.482 [info] 🟣 [xUnit.net 00:00:00.09]   Discovering: Microsoft.CodeAnalysis.LanguageServer.UnitTests
2026-10-26 14:36:07.580 [info] 🟣 [xUnit.net 00:00:00.19]   Discovered:  Microsoft.CodeAnalysis.LanguageServer.UnitTests

3. 14:36:07.660: VSTest receives a successful completion payload

Source: B, line 180. The original line begins:

TpTrace Verbose: 0 : 34702, 12, 2026/10/26, 14:36:07.660, 6502376943682, vstest.console.dll, TestRequestSender.OnDiscoveryMessageReceived: Received message:

Selected fields from that line's JSON message, reformatted for readability; omitted fields are not shown:

{
  "Version": 7,
  "MessageType": "TestDiscovery.Completed",
  "Payload": {
    "TotalTests": 423,
    "IsAborted": false,
    "FullyDiscoveredSources": [
      "/home/rigibson/src/roslyn/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Debug/net10.0/Microsoft.CodeAnalysis.LanguageServer.UnitTests.dll"
    ],
    "PartiallyDiscoveredSources": [],
    "NotDiscoveredSources": [],
    "SkippedDiscoverySources": []
  }
}

The same message's LastDiscoveredTests array contains 423 entries. Of those, 80 have FileBasedProgramsWorkspaceTests in their fully qualified name. These counts represent test cases, including theory cases, not necessarily distinct methods.

One of those entries contains the following fields (other fields omitted):

{
  "Id": "38b22f0b-0e57-41ff-4460-496b3c84a3f9",
  "FullyQualifiedName": "Microsoft.CodeAnalysis.LanguageServer.UnitTests.FileBasedPrograms.FileBasedProgramsWorkspaceTests.GetOrLoadEntryPointDocument_NormalizesPath",
  "DisplayName": "Microsoft.CodeAnalysis.LanguageServer.UnitTests.FileBasedPrograms.FileBasedProgramsWorkspaceTests.GetOrLoadEntryPointDocument_NormalizesPath",
  "ExecutorUri": "executor://xunit/VsTestRunner3/netcore/",
  "Source": "/home/rigibson/src/roslyn/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Debug/net10.0/Microsoft.CodeAnalysis.LanguageServer.UnitTests.dll",
  "CodeFilePath": "/home/rigibson/src/roslyn/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/MiscellaneousFiles/FileBasedProgramsWorkspaceTests.cs",
  "LineNumber": 41
}

4. 14:36:07.683: Test host exits successfully

Source: B, line 186.

TpTrace Information: 0 : 34702, 10, 2026/10/26, 14:36:07.683, 6502399617072, vstest.console.dll, TestHostManagerCallbacks.ExitCallBack: Testhost processId: 34720 exited with exitcode: 0 error: ''

5. 14:36:07.739-14:36:07.767: VSTest finishes discovery and sends completion to the IDE

Source: B, selected lines 195-220.

TpTrace Verbose: 0 : 34702, 12, 2026/10/26, 14:36:07.739, 6502455255206, vstest.console.dll, DiscoveryDataAggregator.MarkSourcesWithStatus: Upgrading /home/rigibson/src/roslyn/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Debug/net10.0/Microsoft.CodeAnalysis.LanguageServer.UnitTests.dll status from 'NotDiscovered' to 'FullyDiscovered'.
TpTrace Verbose: 0 : 34702, 12, 2026/10/26, 14:36:07.762, 6502478380230, vstest.console.dll, ParallelProxyDiscoveryManager.HandlePartialDiscoveryComplete: Total completed clients = 1, Discovery complete = True, Aborted = False, Abort requested: False.
TpTrace Verbose: 0 : 34702, 12, 2026/10/26, 14:36:07.762, 6502478507821, vstest.console.dll, ParallelProxyDiscoveryManager.HandlePartialDiscoveryComplete: All sources were discovered.
TpTrace Verbose: 0 : 34702, 12, 2026/10/26, 14:36:07.765, 6502481790947, vstest.console.dll, ParallelDiscoveryEventsHandler.HandleDiscoveryComplete: Sending discovery complete message to IDE.
TpTrace Verbose: 0 : 34702, 12, 2026/10/26, 14:36:07.766, 6502482340125, vstest.console.dll, DiscoveryRequest.HandleDiscoveryComplete: Begin processing discovery complete notification. Aborted: False, TotalTests: 423
TpTrace Information: 0 : 34702, 12, 2026/10/26, 14:36:07.767, 6502483557737, vstest.console.dll, DiscoveryRequest.HandleDiscoveryComplete: Finished processing discovery complete notification.
TpTrace Information: 0 : 34702, 4, 2026/10/26, 14:36:07.767, 6502483670420, vstest.console.dll, TestRequestManager.DiscoverTests: Discovery tests completed.

6. 14:36:07.779-14:36:07.795: Dev Kit reports an abort and refuses to run tests

Source: A, lines 68-74.

2026-10-26 14:36:07.779 [info] 🟣 The active Tests Discovery was aborted.
2026-10-26 14:36:07.779 [debug] 🔵 Discovery complete [5dad028c-bc0c-43d2-85bb-fb6e67e7b733].
2026-10-26 14:36:07.779 [info] 🟣 Discovery complete for '/home/rigibson/src/roslyn/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Debug/net10.0/Microsoft.CodeAnalysis.LanguageServer.UnitTests.dll'
2026-10-26 14:36:07.780 [debug] 🔵 Discovery marked complete for project '/home/rigibson/src/roslyn/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Microsoft.CodeAnalysis.LanguageServer.UnitTests.csproj[net10.0]' at 2026-10-26T21:36:07.780Z
2026-10-26 14:36:07.794 [debug] 🔵 Switched focus to Test Results view
2026-10-26 14:36:07.795 [debug] 🔵 No runSettingsPath configured. Falling back to default settings.
2026-10-26 14:36:07.795 [info] 🔵 No safely selected tests for 'Microsoft.CodeAnalysis.LanguageServer.UnitTests' after discovery; nothing to run.

Interpretation and limitations

  • The underlying adapter and VSTest successfully discovered the active class, including source-file metadata.
  • The observed contradiction is between VSTest's successful completion and Dev Kit's subsequent abort message, approximately 13 ms after VSTest begins processing its completion notification.
  • Dev Kit's test-service RPC trace records a discoveryComplete callback for this attempt but no reportTests callback.
  • This points investigation toward Dev Kit's consumption/forwarding of VSTest discovery results, but does not establish the precise failing method or root cause.
  • No exception or stack trace explaining the abort was found in the inspected logs.
  • SDK/VSTest compatibility, deserialization, cancellation, and result-processing failures have not been proven or ruled out. No workaround was tested.

Activity

  1. emaf commented on Oct 28, 2026

    @emaf
    Member
  2. peterwald commented on Nov 4, 2026

    @peterwald
    Member
    1. Peter Waldschmidt (@peterwald) Is this related to #3711?

    It's possible, but I am skeptical. Mostly because the OP reported that it was now fixed after an update and additionally it worked differently on different machines.

    This is breaking due to a serialization failure when the vstest translation layer is run in a NativeAOT process. Working on a fix.

  3. vsccarl commented on Nov 18, 2026

    @vsccarl

    Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions