Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress welcome message with get* builds Fixes #38444 #47197

Merged

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Feb 28, 2025

Fixes #38444

This looks at the parseResult and scans it for any of the get* operators: getProperty, getItem, or getTargetResult. If it finds any of them (via string checks), it defers the first use message for the next operation. As the output from get* operators is often parsed, this dramatically simplifies that parsing.

This is the result when calling dotnet build -getProperty:TargetFramework followed by another command that would normally print the welcome message:

image

Notice that the welcome message is still shown (and continues below the screenshot) but does not appear in the part often parsed.

@Copilot Copilot bot review requested due to automatic review settings February 28, 2025 19:23
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Request triage from a team member labels Feb 28, 2025

Choose a reason for hiding this comment

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

PR Overview

This PR fixes issue #38444 by suppressing the welcome message when a get* build option (getProperty, getItem, or getTargetResult) is used. The changes detect these options in the parsed token list and pass a flag to defer the first time use initialization in both Program.cs and DotnetFirstTimeUseConfigurer.cs.

  • Added detection in the command-line parsing to identify get* options.
  • Updated first time use configuration logic to conditionally skip the welcome message.
  • Modified DotnetFirstTimeUseConfigurer to accept and use a new flag for skipping first use checks.

Reviewed Changes

File Description
src/Cli/dotnet/Program.cs Adds detection for get* operators and passes a flag to suppress the welcome message
src/Cli/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs Adjusts the first time use configuration to honor the new skip flag

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

Comments suppressed due to low confidence (2)

src/Cli/dotnet/Program.cs:197

  • [nitpick] Consider renaming 'getStarOptionPassed' to a name like 'suppressWelcomeMessage' to more clearly reflect its purpose.
var getStarOptionPassed = parseResult.CommandResult.Tokens.Any(t =>

src/Cli/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs:54

  • Ensure there are tests covering scenarios where '_skipFirstTimeUseCheck' is true to verify that the welcome message is properly suppressed when intended.
var isFirstTimeUse = !_skipFirstTimeUseCheck && !_firstTimeUseNoticeSentinel.Exists();
Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

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

We should fix this, and it sounds like there's not a really clean way to do so, so this may be the best we can do.

👍

Comment on lines 197 to 200
var getStarOptionPassed = parseResult.CommandResult.Tokens.Any(t =>
t.Value.Contains("getProperty", StringComparison.OrdinalIgnoreCase) ||
t.Value.Contains("getItem", StringComparison.OrdinalIgnoreCase) ||
t.Value.Contains("getTargetResult", StringComparison.OrdinalIgnoreCase));
Copy link
Member

Choose a reason for hiding this comment

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

Instead of just checking that the string contains these values, could we check that it starts with / or - followed by the value?

@Forgind Forgind merged commit 05cf15c into dotnet:release/9.0.3xx Mar 4, 2025
30 checks passed
@Forgind Forgind deleted the suppress-welcome-with-getstar branch March 4, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants