-
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
MissingRestorePropertyError #7280
Conversation
parameterizedSwitch.ShouldBe(CommandLineSwitches.ParameterizedSwitch.RestoreProperty); | ||
duplicateSwitchErrorMessage.ShouldBeNull(); | ||
multipleParametersAllowed.ShouldBeTrue(); | ||
missingParametersErrorMessage.ShouldNotBeNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe specify that this should be the property error message? You would have to get it out of strings with ResourceUtilities.FormatResourceString or something to ensure it works on any locale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a set of these unit tests which are all effectively testing the CommandLineSwitches.IsParameterizedSwitch()
method. That method doesn't retrieve the resource string. It pulls a ParameterizedSwitchInfo
object from the s_parameterizedSwitchesMap
array.
The RestorePropertySwitchIdentificationTests
test could be modified to check that the value of missingParametersErrorMessage
is "MissingPropertyError"
.
Should all of the unit tests with missingParametersErrorMessage.ShouldNotBeNull();
be updated accordingly? (I'm happy to make the changes but I don't want to presume.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good to me. As far as changing any of the other tests, it sounds reasonable to me, but it's less relevant to the main point of this PR, so if you decide to change them all, I'd put that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit test has been updated. Thanks
Copied from issue: ExamplesProperty switch missing property
generates error
RestoreProperty switch missing property
generates error
RestoreProperty and Property switches both missing property
generates error
If the command line has multiple errors, only one error is reported. |
This looks fine since it still makes clear that it's the |
Fixes #7218
Context
MissingRestorePropertyError doesn't exist. The /rp switch accepts properties to be used during a Restore target. The /p switch accepts properties. The InvalidPropertyError is used by both switches. It appears the intent may have been to also share the MissingPropertyError.
Changes Made
Edit for ParameterizedSwitch.RestoreProperty to use MissingPropertyError in place of MissingRestorePropertyError.
Edit to unit test PropertySwitchIdentificationTests to also test the ParameterizedSwitch.RestoreProperty.
Testing
Tested locally built msbuild.exe. An exception is no longer thrown.
Notes