Skip to content
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

Fix bug when determining transitive NoWarn #4256

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private static PackageSpecificWarningProperties ExtractTransitiveNoWarnPropertie
// Merge the node's package specific no warn to the one in the path.
var mergedPackageSpecificNoWarn = MergePackageSpecificNoWarn(pathPackageSpecificNoWarn, nodePackageSpecificNoWarn);

AddDependenciesToQueue(nodeDependencies,
AddDependenciesToQueue(nodeDependencies.Where(i => !seen.ContainsKey(i.Name)),
Copy link
Contributor

@kartheekp-ms kartheekp-ms Sep 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a package dependency that was seen before has a different version than the one, we are processing currently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.. looks to me like this should be based on PR, which are version specific.
https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#suppressing-nuget-warnings

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learnt from NuGet/Home#5740 (comment) comment that NoWarn can be set at the project level as a MSBuild property. This means that NoWarn applies to all the package dependencies including transitive ones.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a package dependency that was seen before has a different version than the one, we are processing currently?

That can't happen (currently at least. With package shading things will get more complex). The point of restore is to resolve the graph and select a single version for each package. Different projects could use different versions, but each project goes through this method independently.

queue,
mergedProjectWideNoWarn,
mergedPackageSpecificNoWarn);
Expand Down Expand Up @@ -228,7 +228,7 @@ private static PackageSpecificWarningProperties ExtractTransitiveNoWarnPropertie
}
}

AddDependenciesToQueue(nodeDependencies,
AddDependenciesToQueue(nodeDependencies.Where(i => !seen.ContainsKey(i.Name)),
queue,
pathWarningProperties.ProjectWide,
pathWarningProperties.PackageSpecific);
Expand Down