-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix --no-build flag error message inconsistency for non-existent project files #49544
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
base: main
Are you sure you want to change the base?
Conversation
…ect files Co-authored-by: marcpopMSFT <[email protected]>
@copilot there are two failing tests that appear to use the project flag with a nonexistent project and are now hitting this new error. The tests are valid so the best solution is to workaround this. For RunParserCanGetArgumentFromDoubleDash, I would just create a project called foo.csproj so that the command finds a valid project when it runs. For MsbuildInvocationIsCorrect, it expects MyProject.csproj but I believe it's copying in HelloWorld.csproj. I would try changing the data driven test to match |
Co-authored-by: marcpopMSFT <[email protected]>
Fixed both failing tests as suggested:
Both tests now pass while preserving the original file existence validation functionality. Commit: 47d4222 |
@copilot for test RunParserCanGetArgumentFromDoubleDash, can you use CopyTestAsset("HelloWorld") like other tests and you don't need to clean up the project after as we run each test in a different folder? |
…Dash test Co-authored-by: marcpopMSFT <[email protected]>
Changed the test to use Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
The
--no-build
flag indotnet run
was producing misleading error messages when project files don't exist. This created confusion for developers who would see different error messages depending on whether they used--no-build
or not.Problem
When running
dotnet run
with a non-existent project file:--no-build
: "Project file does not exist." (clear and helpful)--no-build
: "'xyz.csproj' is not a valid project file." (misleading - suggests the file exists but is malformed)Example
Solution
Added a file existence check in the
DiscoverProjectFilePath
method before attempting to load the project. When a specified project file doesn't exist, both code paths now provide a consistent, clear error message using the existing localized stringCmdNonExistentFileErrorDescription
.After the fix
Both cases now show the same clear message:
Changes
RunCommand.cs
: Added file existence validation inDiscoverProjectFilePath
methodItProvidesConsistentErrorMessageWhenProjectFileDoesNotExistWithNoBuild
to validate the fixThe fix is minimal and surgical - it only adds a file existence check when a project file path is explicitly provided and doesn't exist, ensuring consistent error messaging across both build and no-build scenarios.
Fixes #24591.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
4m6vsblobprodcus384.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)4zjvsblobprodcus390.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)ajhvsblobprodcus363.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)c78vsblobprodcus322.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)d0svsblobprodcus381.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)jd4vsblobprodcus366.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)josvsblobprodcus372.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)k0ivsblobprodcus356.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)k4kvsblobprodcus344.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)nn8vsblobprodcus340.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)pe3vsblobprodcus354.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)rcxvsblobprodcus328.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)ukkvsblobprodcus352.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)yttvsblobprodcus357.vsblob.vsassets.io
/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -v:m
(dns block)/home/REDACTED/work/sdk/sdk/artifacts/bin/redist/Debug/dotnet/dotnet run -p /home/REDACTED/work/sdk/sdk/artifacts/tmp/Debug/ItWarnsWhenSh---7BBD1F37/MSBuildTestApp.csproj
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.