-
Notifications
You must be signed in to change notification settings - Fork 25
[BUG] Test Explorer does not pick up code changes after build #1971
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
Comments
Adding a repro project Repro Steps:
|
@lifengl in the current scenario, what should be the correct output folder ? [project]\bin\Debug\net9.0[dll] or [project]\bin\x64\Debug\net9.0[dll] |
Test Explorer gets the output folder of projects from project queryable space (Project System) cc: @Jxwoon assigning this issue to Lifeng since CPS owns this service |
@mareklinka After some investigation, it looks like the issue is due to a missing platform assignment for the individual projects in your .slnx file. Without this explicit mapping, MSBuild falls back to default logic, which can result in output paths like To resolve this, try updating your .slnx file to include a platform mapping for each project, like so:
Please let me know if that works for you! |
Thanks for the hint, I now updated the my solution file so that each project has a platform assignment, as you suggested:
Now when I build the solution, the build output goes to I removed all the
As you can see, for some reason, the Test Explorer is still looking for test assemblies in the default folder, not in the |
I tried to reproduce the issue on my end but wasn’t able to hit the same behavior. Here’s what I did:
After the build, I saw the following:
@mareklinka Could you confirm how you're running the build operation? Are you right-clicking the solution node in Solution Explorer, or are you using the CLI with dotnet build? Also, does clicking the Refresh button in the Test Explorer help trigger test discovery for you? Edit: Also, please let me know if I'm missing a step here. |
I created a trivial minimal repro for this case. Please find it attached. Without any bells and whistles, just opening the slnx file in VSCode. Hitting
Now opening the VSC's command palette and hitting "Developer: Reload Window", this is the output of the
If I go to the Test Explorer and hit
So now all the builds output into the same paths, whether they are triggered manually or via the Test Explorer. However, the Test Explorer is still trying to find the assemblies in the incorrect path. Just in case, extension versions: |
@Jxwoon, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer. |
@mareklinka Thanks for providing a repro! Based on it, it looks like you’ll also need to modify the .csproj file. In your example, please open the project2.csproj file and add the following platform mapping: csproj example:
The .csproj file defines what the project itself supports. If x64 isn’t declared there, the project won’t recognize it as a valid build target—even if the solution tries to use it. Once the platform is added to the .csproj file, the Test Explorer should display the tests. |
Thanks for the reply, that did the trick! Now everything seems to in line. Thanks for helping me figure this out! |
Describe the Issue
Recently I noticed that when I make changes to my code and run tests via Test Explorer, the code changes are not reflected in the test run until I manually build my solution - despite the fact that the Test Explorer runs a build before executing the tests.
I noticed a discrepancy in build output paths between my normal build and the build triggered by Test Explorer:
Normal build builds my entire solution and the output path is
[project]\bin\Debug\net9.0\[dll]
Test Explorer build builds only the test project and the output path is
[project]\bin\x64\Debug\net9.0\[dll]
(notice the additionalx64
folder in the path).This seems to cause the problem - because when I look at where Test Explorer looks when doing test discovery, it's
[project]\bin\Debug\net9.0\[dll]
- without thex64
in the path.In case this might be relevant, we are using the new SLNX solution format with the following config:
The build commands themselves:
Manual:
dotnet build Solution.slnx /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary /p:Configuration=Debug /p:Platform="x64"
Test Explorer:
dotnet build TestProject.csproj /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary /p:Configuration=Debug /p:Platform="x64"
Steps To Reproduce
No response
Expected Behavior
I would expect that the paths used to build, execute, and discover tests are the same.
Environment Information
Version: 1.99.3 (user setup)
Commit: 17baf841131aa23349f217ca7c570c76ee87b957
Date: 2025-04-15T23:18:46.076Z
Electron: 34.3.2
ElectronBuildId: 11161073
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100
C# Dev Kit 1.19.45
The text was updated successfully, but these errors were encountered: