Repository navigation
Add HelpLink attribute to Error and Warning tasks in CommonTypes.xsd - #14299
jankratochvilcz wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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
HelpLinkas an attribute on theErrortask element inMicrosoft.Build.CommonTypes.xsd. - Add
HelpLinkas an attribute on theWarningtask element inMicrosoft.Build.CommonTypes.xsd.
|
Caution agentic threat detected Code Review — Expert Analysis24-dimension review complete. All dimensions LGTM except one moderate observation. ✅ SummaryThe change is correct, minimal, and well-scoped. 🟡 Observation (MODERATE — not blocking merge)Dimension: Test Coverage The original drift (
A guard test would reflect over each task class (e.g., All 24 dimensions evaluated. No blocking or major findings. The fix is ready to merge.
|
|
Caution agentic threat detected Review complete. The expert-reviewer subagent analyzed all 24 dimensions and found no blocking issues. All safe-output slots for
|
There was a problem hiding this comment.
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
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
Fixes #5567
The
HelpLinkproperty was added to theErrorandWarningtasks in PR #5488, but the IntelliSense schema (Microsoft.Build.CommonTypes.xsd) was never updated, so Visual Studio does not offer it. This adds theHelpLinkattribute alongside the existingHelpKeywordattribute in both theErrorandWarningtask elements.Verified
HelpLinkexists as astringproperty on bothsrc/Tasks/Error.csandsrc/Tasks/Warning.cs. XSD remains well-formed XML;dotnet msbuild src/MSBuild/MSBuild.csprojbuilds with 0 warnings.