Repository navigation
Default XML tasks to prohibit DTDs and improve DTD error diagnostics - #14285
Merged
VolPlita merged 27 commits intoJul 30, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR unifies DTD handling across XmlPeek, XmlPoke, and XslTransformation by introducing a shared XML settings utility, defaulting these tasks to prohibit DTDs, and improving diagnostics when DTD-bearing inputs are blocked.
Changes:
- Default
ProhibitDtdtotrueinXmlPeek,XmlPoke, andXslTransformation, and route XML/XSLT parsing through centralizedXmlTaskUtilitysettings. - Add DTD-specific error paths/messages for load/transform failures to improve diagnosability.
- Update/extend unit tests to cover the new DTD-prohibited diagnostics and ensure non-DTD failures still produce generic errors.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Tasks/XslTransformation.cs | Adds ProhibitDtd defaulting to true, uses shared reader settings, and emits DTD-specific errors for XSLT load/transform. |
| src/Tasks/XmlTaskUtility.cs | New helper for consistent XmlReaderSettings creation and DTD detection/exception classification. |
| src/Tasks/XmlPoke.cs | Adds ProhibitDtd defaulting to true, uses shared reader settings, and emits a DTD-specific input error. |
| src/Tasks/XmlPeek.cs | Defaults ProhibitDtd to true and adds DTD-specific input error diagnostics. |
| src/Tasks/Resources/Strings.resx | Adds new resource entries for DTD-specific error messages for XmlPeek/XmlPoke and XslTransformation. |
| src/Tasks/Microsoft.Build.Tasks.csproj | Includes the new XmlTaskUtility.cs in the Tasks project build. |
| src/Tasks.UnitTests/XslTransformation_Tests.cs | Adds tests validating DTD-specific diagnostics and generic error behavior for non-DTD failures. |
| src/Tasks.UnitTests/XmlPoke_Tests.cs | Adds tests validating DTD-specific diagnostics and generic error behavior for malformed XML. |
| src/Tasks.UnitTests/XmlPeek_Tests.cs | Updates tests for new default behavior and adds coverage for DTD-specific diagnostics. |
| src/Tasks/Resources/xlf/Strings.zh-Hant.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.zh-Hans.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.tr.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.ru.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.pt-BR.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.pl.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.ko.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.ja.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.it.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.fr.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.es.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.de.xlf | Adds new trans-units for the DTD-specific messages. |
| src/Tasks/Resources/xlf/Strings.cs.xlf | Adds new trans-units for the DTD-specific messages. |
VolPlita
force-pushed
the
fix-5817-tasks-prohibit-dtd-defaults
branch
from
July 8, 2026 12:19
d76e3d4 to
04cf595
Compare
VolPlita
marked this pull request as ready for review
July 8, 2026 12:58
AlesProkop
requested changes
Jul 9, 2026
VolPlita
force-pushed
the
fix-5817-tasks-prohibit-dtd-defaults
branch
from
July 9, 2026 15:19
99f437d to
44b055f
Compare
AlesProkop
requested changes
Jul 10, 2026
AlesProkop
left a comment
Member
There was a problem hiding this comment.
Looks good now. Just one more thing.
VolPlita
force-pushed
the
fix-5817-tasks-prohibit-dtd-defaults
branch
from
July 10, 2026 08:24
0af3674 to
f159bb4
Compare
AlesProkop
approved these changes
Jul 10, 2026
AlesProkop
left a comment
Member
There was a problem hiding this comment.
LGTM now. Just resolve the failing tests.
VolPlita
enabled auto-merge (squash)
July 10, 2026 14:27
VolPlita
requested review from
AlesProkop,
JanProvaznik and
rainersigwald
and removed request for
JanProvaznik
July 10, 2026 14:27
JanProvaznik
requested changes
Jul 16, 2026
This was referenced Nov 20, 2026
Bump Microsoft.Build.Framework and Microsoft.Build.Utilities.Core
sharedsourceheritage/MSBuildSdks#7
Open
Open
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5817 #5810
Context
XmlPeek,XmlPoke, andXslTransformationwere inconsistent around DTD handling and often produced generic errors when DTD input was blocked, making failures hard to diagnose.Changes Made
ProhibitDtdtotrueinXmlPeek,XmlPoke, andXslTransformation.XmlTaskUtilityto centralize XML reader settings and DTD detection helpers.DtdProcessing.Ignore) for compatibility.Testing
Notes