MissingRestorePropertyError#7280
MissingRestorePropertyError#7280ladipro merged 11 commits intodotnet:mainfrom jrdodds:MissingRestorePropertyError
Conversation
| parameterizedSwitch.ShouldBe(CommandLineSwitches.ParameterizedSwitch.RestoreProperty); | ||
| duplicateSwitchErrorMessage.ShouldBeNull(); | ||
| multipleParametersAllowed.ShouldBeTrue(); | ||
| missingParametersErrorMessage.ShouldNotBeNull(); |
There was a problem hiding this comment.
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.
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.
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.
The unit test has been updated. Thanks
Co-authored-by: Forgind <Forgind@users.noreply.github.com>
|
Copied from issue: ExamplesProperty switch missing propertygenerates error RestoreProperty switch missing propertygenerates error RestoreProperty and Property switches both missing propertygenerates 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