-
Notifications
You must be signed in to change notification settings - Fork 420
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
Clean up unresolved dependencies check #862
Clean up unresolved dependencies check #862
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.
LGTM, unless you see some value in adding tests. I'm split the code isn't super complicated.
|
||
namespace OmniSharp.MSBuild.Resolution | ||
{ | ||
internal class PackageDependencyResolver |
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.
Is there much value in writing tests for this class?
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.
I think there's definitely value in having tests, but I don't want to gate this PR on them. I want to write tests for the MSBuildProjectSystem in general because there's really not much today. Now that we have the test infrastructure in place, I'd like to write some broader MSBuildProjectSystem tests.
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.
Added #863 to track adding tests.
var unresolved = libraryManager.GetLibraries().Where(dep => !dep.Resolved); | ||
var needRestore = allDiagnostics.Any(diag => diag.ErrorCode == ErrorCodes.NU1006) || unresolved.Any(); | ||
var unresolvedLibraries = libraryManager.GetLibraries().Where(dep => !dep.Resolved); | ||
var needRestore = allDiagnostics.Any(diag => diag.ErrorCode == ErrorCodes.NU1006) || unresolvedLibraries.Any(); |
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.
when lock file doesn't exist at all I believe the error code would be NU1009
.
Should that be taken into account as well? a restore would then generate the lock file
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.
actually, maybe it doesn't matter anymore - it's legacy
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.
Yeah, I wasn't trying to clean up DotNetProjectSystem
too much. I've been thinking of that as a bit frozen so I don't unintentionally break anything.
Fixes dotnet/vscode-csharp#1272
This change cleans up the logic (which had gotten kinda messy) that resolves MSBuild package references against a project's lock file. This also adds logging when package references can't be resolved, which should help diagnose situations where VS Code is getting restore prompts unnecessarily.