Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented Oct 1, 2025

Description and customer impact

Fixes #51077.

Empty property values specified via the #:property directive were incorrectly disallowed even though the spec says they should be allowed. This is useful in some scenarios like clearing the default TargetFramework when I want to specify TargetFrameworks (plural) which is how I discovered this.

Regression

No, I think this was always broken.

Risk

Low, a simple change, allowing a scenario that was previously an error.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Oct 1, 2025
Copy link
Contributor

github-actions bot commented Oct 1, 2025

This PR is targeting main, which is now for .NET 11-facing work. If you intended to target .NET 10, either retarget this PR to release/10.0.1xx or make sure you backport the change to release/10.0.1xx after merging. See #50394 for more details.

@jjonescz jjonescz changed the base branch from main to release/10.0.1xx October 1, 2025 10:05
@jjonescz jjonescz marked this pull request as ready for review October 1, 2025 11:26
@jjonescz jjonescz requested review from a team and Copilot October 1, 2025 11:26
Copy link
Contributor

@Copilot Copilot AI left a comment

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 allows file-level directive values to be empty in .NET CLI commands. The change addresses issue #51077 by modifying the directive parsing logic to handle empty values instead of treating them as missing values.

Key Changes

  • Updated directive parsing logic to distinguish between missing and empty values
  • Added comprehensive test coverage for empty directive values across different directive types

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Modified ParseOptionalTwoParts method to return empty string for whitespace-only values instead of null
test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs Added test method Directives_EmptyValue to verify empty directive values are handled correctly

@jjonescz
Copy link
Member Author

jjonescz commented Oct 2, 2025

@RikkiGibson @333fred @MiYanni for reviews, thanks

@jjonescz
Copy link
Member Author

jjonescz commented Oct 6, 2025

@RikkiGibson for a review, thanks

@jjonescz jjonescz requested a review from RikkiGibson October 6, 2025 08:22

var secondPart = i < 0 ? [] : context.DirectiveText.AsSpan((i + 1)..).TrimStart();
if (i < 0 || secondPart.IsWhiteSpace())
if (i < 0)
Copy link
Member

Choose a reason for hiding this comment

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

nit: if I reviewed the original implementation of this method today, I would say to rename this to separatorIndex. As this isn't a loop variable, and its scope is quite broad, encountering this as the first line of the "Files changed", feels a bit opaque :)

@jjonescz jjonescz enabled auto-merge (squash) October 7, 2025 08:56
@jjonescz jjonescz merged commit a48d94a into dotnet:release/10.0.1xx Oct 7, 2025
27 checks passed
@jjonescz jjonescz deleted the sprint-empty-values branch October 7, 2025 18:05
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 Servicing-approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File-level directives do not allow empty values

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.