-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Invalid property name passed at the command line does not emit error #9475
Comments
We throw:
That is caught and a new exception thrown
That's caught, logged, and rethrown msbuild/src/Build/Definition/ProjectCollection.cs Lines 356 to 360 in 5fcddc7
That's caught, the logger shut down, and rethrown. I would expect the logger shutdown to flush the message. |
Ah, but there are no loggers, so nowhere for that message to go. |
Ah but in
Lines 3633 to 3635 in 5fcddc7
In the
|
The proximate cause of this bug is dotnet/sdk#37230, but you can repro the no-logger-so-no-error problem with any MSBuild by passing |
It looks like you successfully reproduced the problem. /p:UseRidGraph:false is incorrect, yet we fail without giving any indication of that failure. You can see the initial message telling you that MSBuild is trying to execute, but then it fails and exits without logging anything else. This is a bug in error reporting, not a bug in outcome, and you reproduced it. |
Fixes #9475 Context When a property name is an invalid input, we log the error and shutdown the loggers when terminating the process. However, we did not flush the logs of any messages being processed before shutting down, making we miss this specific error in the process. Changes Made Added a wait for loggers to finish doing their work before shutting down. Testing Added a test to make sure that the logger emits the message before shutdown.
Issue Description
Specifying /p:Property:value instead of /p:Property=value leads to an aborted build when using dotnet build.
Steps to Reproduce
Expected Behavior
One line for the MSBuild version followed by a line specifying that the property is not valid (MSB1006) then telling me which exactly was wrong like:
MSBuild version 17.9.0-dev-23579-01+5fcddc790 for .NET Framework
MSBUILD : error MSB1006: Property is not valid.
Switch: UseRidGraph:false
For switch syntax, type "MSBuild -help"
Actual Behavior
It just told me the version with no errors:
MSBuild version 17.8.3+195e7f5a3 for .NET
Analysis
I tried this with MSBuild.exe (from main, not 17.8.3), and it worked as expected. I tried dotnet MSBuild.dll with the MSBuild freshly built from main, and it worked as expected. I tried using MSBuild.exe from my VS preview (version 17.9.0-preview-23574-01+7b37a280a), and this bug still didn't reproduce. Then I built MSBuild main and used the deploy script to overwrite my 8.0.100 SDK, and this bug finally reproduced.
That means this may be Core-specific (a CLI bug?) or it may be specific to some component that MSBuild does not overwrite with the deploy script. Of note, it does still print out the version, which (I think) means MSBuild knows it's supposed to be executing and tries to execute but ultimately fails without logging anything further.
Versions & Configurations
8.0.100 SDK with MSBuild version above.
The text was updated successfully, but these errors were encountered: