-
Notifications
You must be signed in to change notification settings - Fork 694
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
Output a more debuggable message if a single value isn't specified #5533
Output a more debuggable message if a single value isn't specified #5533
Conversation
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 change looks great!
A few things:
- Can you please create an issue for this?
- Can youn please add some tests: https://github.com/NuGet/NuGet.Client/blob/dev/test/NuGet.Clients.Tests/NuGet.SolutionRestoreManager.Test/VsSolutionRestoreServiceTests.cs has integration tests, but this is something that should be easily unit testable.
src/NuGet.Clients/NuGet.SolutionRestoreManager/VSNominationUtilities.cs
Outdated
Show resolved
Hide resolved
@nkolev92: looking to see if there was an existing bug, I see NuGet/Home#8749 looks somewhat related -- want to call this as fixing that or have me file a new bug? |
Nice catch, that's perfect. |
A number of places call GetSingleNonEvaluatedPropertyOrNull to get the single value that spans all TFMs -- if that's not distinct though the failure that would bubble up to the user wouldn't point to the underlying issue. This makes the failure easier. Fixes NuGet/Home#8749
4a1eb15
to
b0a0ec8
Compare
@nkolev92 Exception message is now localized, and tests added. I broke out a test refactoring into a prior commit so it's a touch easier to review. |
A number of places call GetSingleNonEvaluatedPropertyOrNull to get the single value that spans all TFMs -- if that's not distinct though the failure that would bubble up to the user wouldn't point to the underlying issue. This makes the failure easier.
Bug
Fixes: NuGet/Home#8749
Regression? No.
Description
This adds a better exception message than simply calling SingleOrDefault(). The test changes mostly involve extracting out a helper function for other tests doing the same thing.
PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Documentation