Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XUnit v3 packages cause VSCode 'codelens' debugging to become unavailable (tests are otherwise discovered okay in the sidebar) #237197

Closed
kieranbenton opened this issue Jan 2, 2025 · 7 comments
Assignees
Labels
*caused-by-extension Issue identified to be caused by an extension

Comments

@kieranbenton
Copy link

  • VS Code Version: 1.96.2 (Universal)
  • OS Version: Mac OS 15.1.1 (24B91)

Already opened as a bug on xunit but they think this is a VSCode issue: xunit/visualstudio.xunit#433.

Reproduction at: https://github.com/kieranbenton/MyFirstUnitTests ready to go.

Steps to Reproduce:

(NOTE: These are from scratch, but you can use the reproduction above to skip to the end).

image
  • Follow the v2 -> v3 migration steps (leaving the old package references commented out in csproj)
image
  • dotnet clean, dotnet build - test is still discoverable in 'Testing' panel but the code lens actions AREN'T available
image
  • Swap the package references back, dotnet clean + dotnet build - and its trivial to get the codelens support back

Nothing particularly smoking-gun esque in logs that I can find:

Tests removed: /Users/kieranbenton/Source/kaizenticketing/MyFirstUnitTests/bin/Debug/net9.0/MyFirstUnitTests.dll
Tests are available, running test discovery: /Users/kieranbenton/Source/kaizenticketing/MyFirstUnitTests/bin/Debug/net9.0/MyFirstUnitTests.dll
Scheduling discovery: /Users/kieranbenton/Source/kaizenticketing/MyFirstUnitTests/bin/Debug/net9.0/MyFirstUnitTests.dll [1735404920350]
========== Starting test discovery ==========
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.0.0+e341b939fe (64-bit .NET 9.0.0)
[xUnit.net 00:00:00.26]   Discovering: MyFirstUnitTests
[xUnit.net 00:00:00.37]   Discovered:  MyFirstUnitTests
========== Test discovery finished: 1 Tests found in 590 ms ==========
1 tests discovered from /Users/kieranbenton/Source/kaizenticketing/MyFirstUnitTests/bin/Debug/net9.0/MyFirstUnitTests.dll in 590.0289 ms
@connor4312
Copy link
Member

This would indicate that the debug extension is not associating a location (file or range) with the tests. Just doing a quick search on their extension it seems like other users might have this problem too, e.g. microsoft/vscode-dotnettools#1704

@connor4312 connor4312 added the *caused-by-extension Issue identified to be caused by an extension label Jan 6, 2025
Copy link

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines. If you don't know which extension is causing the problem, you can run Help: Start extension bisect from the command palette (F1) to help identify the problem extension.

Happy Coding!

@bradwilson
Copy link

bradwilson commented Jan 6, 2025

I disagree with the analysis that "we're not providing source information", because something is allowing a user to navigate from the test window to source code correctly (and that something is the source & line number metadata that is claimed isn't present).

The below video was captured using xunit.runner.visualstudio version 3.0.1-pre.7:

Recording.2025-01-06.105057.mp4

Can you please explain to me why navigation from the test tree into the source code works, but the icons don't, in a way that is our fault?

@kieranbenton
Copy link
Author

@connor4312 can you reopen please and review @bradwilson 's information? Thanks.

@connor4312
Copy link
Member

connor4312 commented Jan 6, 2025

You case looks different from the reporter's. The reporter said that navigation stops working and the "run" buttons disappear, which is behavior consistent with a missing test location (their 3rd screenshot). In your case it seems like navigation works and the run buttons do appear correctly -- I don't see any issues with your recording.

@bradwilson
Copy link

Sorry, I may have simultaneously fixed the issue and misunderstood how it surfaced. 😬 😂

@connor4312
Copy link
Member

All good, let me know if you run into anything else that might be vscode side :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*caused-by-extension Issue identified to be caused by an extension
Projects
None yet
Development

No branches or pull requests

4 participants