Skip to content

Check every output for duplicate producers #165

Description

Summary

CheckForDuplicateOutputs returns from the entire method after registering the first previously unseen output instead of continuing to the next output.

Impact

A node registers at most its first ordinary output in _outputProducer. Duplicate-path conflicts and invalid reads of another project's outputs are therefore not detected for the remaining outputs. This disables an important cache-correctness diagnostic on both cache-hit and post-build paths.

Evidence

In src/Common/MSBuildCachePluginBase.cs:

foreach (...)
{
    NodeContext previousNode = _outputProducer.GetOrAdd(relativeFilePath, nodeContext);
    if (previousNode == nodeContext)
    {
        return;
    }
    ...
}

The control flow contradicts the per-output loop and comment.

Suggested fix

Continue to the next output after successfully registering a first producer. Add tests with multiple outputs where only a later path is duplicated, covering identical and conflicting content as well as producer ordering.

Acceptance criteria

  • Every output is registered and checked.
  • A duplicate in any position is detected.
  • Allowed identical duplicates retain their current behavior.
  • Both cache-hit and completed-build paths are covered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions