Skip to content

Disallow : in property directives - #55671

Open
jjonescz wants to merge 1 commit into
dotnet:mainfrom
jjonescz:sprint-colon
Open

Disallow : in property directives#55671
jjonescz wants to merge 1 commit into
dotnet:mainfrom
jjonescz:sprint-colon

Conversation

@jjonescz

@jjonescz jjonescz commented Aug 7, 2026

Copy link
Copy Markdown
Member

Fixes #55670.

@jjonescz
jjonescz requested review from a team and Copilot August 7, 2026 09:46
@jjonescz
jjonescz requested a review from a team as a code owner August 7, 2026 09:46
@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Aug 7, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

This PR addresses #55670 by preventing #:property directives from accepting XML namespace-style names (e.g. A:B), which can lead to invalid MSBuild project XML and confusing “undeclared prefix” load failures.

Changes:

  • Tighten #:property name validation to require an XML NCName (disallowing :) via XmlConvert.VerifyNCName.
  • Extend dotnet project convert directive validation tests to cover the new invalid : case (and keep coverage for invalid leading characters).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs Updates directive validation test to include Prefix:Name and parameterizes invalid-name expectations.
src/Cli/Microsoft.DotNet.FileBasedPrograms/FileLevelDirectiveHelpers.cs Switches property-name validation from VerifyName to VerifyNCName to reject : and avoid generating invalid project XML.

@jjonescz
jjonescz requested review from 333fred and RikkiGibson August 7, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-run-file Items related to the "dotnet run <file>" effort

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Colons in #:property names should be disallowed

3 participants