Skip to content

Commit

Permalink
Merge pull request #9537 from drewnoakes/fix-9230-lingering-analyzer-…
Browse files Browse the repository at this point in the history
…nodes

Fix lingering analyzer node with warning
  • Loading branch information
drewnoakes committed Sep 23, 2024
2 parents 9e618da + bdb6aa0 commit 6e9e699
Show file tree
Hide file tree
Showing 4 changed files with 368 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,25 @@ internal MSBuildDependency With(bool? isResolved, bool isImplicit, DiagnosticLev
return this;
}

internal MSBuildDependency With(bool isResolved, ProjectImageMoniker icon, ProjectTreeFlags flags, DiagnosticLevel diagnosticLevel)
internal MSBuildDependency With(bool isResolved, ProjectImageMoniker icon, ProjectTreeFlags flags, DiagnosticLevel diagnosticLevel, string caption, string? filePath)
{
if (isResolved != IsResolved ||
diagnosticLevel != DiagnosticLevel ||
icon != Icon ||
flags != Flags)
flags != Flags ||
caption != Caption ||
filePath != FilePath)
{
return new MSBuildDependency(
_factory,
Id,
Caption,
caption,
icon,
flags,
diagnosticLevel,
isResolved,
IsImplicit,
FilePath,
filePath,
BrowseObjectProperties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void ProcessRemovals()

if (id is not null && _dependencyById.TryGetValue(id, out MSBuildDependency? dependency))
{
if (!_factory.ResolvedItemRequiresEvaluatedItem && !evaluationProjectChange.Before.Items.ContainsKey(id))
if (!_factory.ResolvedItemRequiresEvaluatedItem && !evaluationProjectChange.After.Items.ContainsKey(id))
{
// The item is not present in evaluation, and this factory doesn't require an evaluated item.
// The removal of the build item means that the item must be removed altogether, as there's no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ internal bool TryMakeUnresolved(MSBuildDependency dependency, out MSBuildDepende
DiagnosticLevel diagnosticLevel = dependency.DiagnosticLevel <= DiagnosticLevel.Warning ? DiagnosticLevel.Warning : dependency.DiagnosticLevel;
ProjectTreeFlags flags = UpdateTreeFlags(dependency.Id, FlagCache.Get(isResolved: false, dependency.IsImplicit));
ProjectImageMoniker icon = GetIcon(dependency.IsImplicit, diagnosticLevel);
updated = dependency.With(isResolved: false, icon: icon, flags: flags, diagnosticLevel: diagnosticLevel);
string caption = GetUnresolvedCaption(dependency.Id, dependency.BrowseObjectProperties);
updated = dependency.With(isResolved: false, icon: icon, flags: flags, diagnosticLevel: diagnosticLevel, caption: caption, filePath: dependency.Id);
return !ReferenceEquals(dependency, updated);
}

Expand Down
Loading

0 comments on commit 6e9e699

Please sign in to comment.