Skip to content

Add HelpLink attribute to Error and Warning tasks in CommonTypes.xsd - #14299

Closed
jankratochvilcz wants to merge 1 commit into
mainfrom
jankratochvilcz-xsd-helplink-error-warning
Closed

jankratochvilcz wants to merge 1 commit into
mainfrom
jankratochvilcz-xsd-helplink-error-warning

Conversation

@jankratochvilcz

Copy link
Copy Markdown
Contributor

Fixes #5567

The HelpLink property was added to the Error and Warning tasks in PR #5488, but the IntelliSense schema (Microsoft.Build.CommonTypes.xsd) was never updated, so Visual Studio does not offer it. This adds the HelpLink attribute alongside the existing HelpKeyword attribute in both the Error and Warning task elements.

Verified HelpLink exists as a string property on both src/Tasks/Error.cs and src/Tasks/Warning.cs. XSD remains well-formed XML; dotnet msbuild src/MSBuild/MSBuild.csproj builds with 0 warnings.

The HelpLink property was added to the Error and Warning tasks in PR #5488
but the IntelliSense schema was never updated. Add the HelpLink attribute
alongside HelpKeyword so Visual Studio offers it.

Fixes #5567

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the MSBuild IntelliSense XSD (Microsoft.Build.CommonTypes.xsd) to reflect the already-shipped HelpLink property on the Error and Warning tasks, enabling Visual Studio to offer HelpLink in IntelliSense for those task elements.

Changes:

  • Add HelpLink as an attribute on the Error task element in Microsoft.Build.CommonTypes.xsd.
  • Add HelpLink as an attribute on the Warning task element in Microsoft.Build.CommonTypes.xsd.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

The threat detection results could not be parsed.

Review the workflow run logs for details.

Code Review — Expert Analysis

24-dimension review complete. All dimensions LGTM except one moderate observation.


✅ Summary

The change is correct, minimal, and well-scoped. HelpLink exists as a functional string property on both Error.cs and Warning.cs, the XSD attributes are placed in alphabetical order consistent with the surrounding schema, and the untyped <xs:attribute /> form is correct (typed xs:anyURI would reject common patterns like HelpLink="$(DocsBase)/$(Code)" as schema violations during VS validation).


🟡 Observation (MODERATE — not blocking merge)

Dimension: Test Coverage

The original drift (HelpLink added to C# in PR #5488 but XSD not updated) went undetected for ~4 years, caught only by a manual audit. There are no automated tests that verify XSD attribute completeness against task class properties. The same silent drift can happen again with any future property addition.

src/MSBuild.UnitTests/ProjectSchemaValidationHandler_Tests.cs already loads Microsoft.Build.CommonTypes.xsd as a resource, which is the natural home for such a check.

A guard test would reflect over each task class (e.g., Error, Warning), collect its public string and bool properties, then assert each has a corresponding <xs:attribute> in the XSD. Not required for this PR, but worth tracking as a follow-up to close the systemic gap that created issue #5567.


All 24 dimensions evaluated. No blocking or major findings. The fix is ready to merge.

Generated by Expert Code Review (on open) for #14299 · 1.1K AIC · ⊞ 30.4K · ◷

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

The threat detection results could not be parsed.

Review the workflow run logs for details.

Review complete. The expert-reviewer subagent analyzed all 24 dimensions and found no blocking issues. All safe-output slots for submit_pull_request_review and noop were consumed by the subagent. The design-level observation about adding a test to guard against future XSD/C# drift was posted separately.

Generated by Expert Code Review (on open) for #14299 · 1.1K AIC · ⊞ 30.4K · ◷

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

The threat detection results could not be parsed.

Review the workflow run logs for details.

Test Coverage & Completeness — ISSUE

No regression test for this bug fix; the same class of drift is trivially reproducible.

The root cause here is XSD/C# property drift: HelpLink was added to Error and Warning in 2021 and went undetected for ~4 years. The fix correctly adds the missing XSD attributes, but adds no test to prevent recurrence.

Concrete failing scenario without a regression test:

A developer adds a new property (e.g. SeverityText) to Error.cs — a plausible near-future change. No test fails. IntelliSense silently omits it. The bug reproduces in exactly the same way as this one did.

Suggested regression test (in src/Tasks.UnitTests/ or src/MSBuild.UnitTests/):

[Fact]
public void ErrorAndWarningTaskXsdAttributesShouldMatchClassProperties()
{
    var xsdPath = Path.Combine(
        Path.GetDirectoryName(typeof(MSBuildApp).Assembly.Location)!,
        "MSBuild", "Microsoft.Build.CommonTypes.xsd");

    var doc = XDocument.Load(xsdPath);
    XNamespace xs = "(www.w3.org/redacted)

    HashSet<string> GetXsdAttributes(string taskName) =>
        doc.Descendants(xs + "element")
           .Where(e => (string?)e.Attribute("name") == taskName)
           .SelectMany(e => e.Descendants(xs + "attribute"))
           .Select(a => (string)a.Attribute("name")!)
           .ToHashSet(StringComparer.Ordinal);

    HashSet<string> GetTaskProperties(Type taskType) =>
        taskType.GetProperties(BindingFlags.Public | BindingFlags.Instance)
                .Where(p => p.PropertyType == typeof(string))
                .Select(p => p.Name)
                .ToHashSet(StringComparer.Ordinal);

    foreach (var (typeName, taskType) in new[] {
        ("Error",   typeof(Microsoft.Build.Tasks.Error)),
        ("Warning", typeof(Microsoft.Build.Tasks.Warning)) })
    {
        var xsdAttrs    = GetXsdAttributes(typeName);
        var csharpProps = GetTaskProperties(taskType);

        foreach (var prop in csharpProps)
            xsdAttrs.ShouldContain(prop,
                $"{typeName} task property '{prop}' is missing from CommonTypes.xsd");
    }
}

This test fails on the pre-fix XSD (HelpLink absent) and passes after the fix — making it a true regression guard. Without it, the fix is correct but the underlying class of bug has no automated barrier.

Generated by Expert Code Review (on open) for #14299 · 1.1K AIC · ⊞ 30.4K

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 29acbcdb Deployed Jul 9, 2026 by jankratochvilcz via conclusion #412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New HelpLink API is missing from IntelliSense

2 participants