Skip to content

stop using System.CommandLine types that won't be public anymore #116065

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

Merged
merged 8 commits into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>da5dd054a531e6fea65643b7e754285b73eab433</Sha>
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta5.25260.104">
<Dependency Name="System.CommandLine" Version="2.0.0-beta5.25279.2">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>85778473549347b3e4bad3ea009e9438df7b11bb</Sha>
</Dependency>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
<!-- Not auto-updated. -->
<MicrosoftDiaSymReaderVersion>2.0.0</MicrosoftDiaSymReaderVersion>
<MicrosoftDiaSymReaderNativeVersion>17.10.0-beta1.24272.1</MicrosoftDiaSymReaderNativeVersion>
<SystemCommandLineVersion>2.0.0-beta5.25260.104</SystemCommandLineVersion>
<SystemCommandLineVersion>2.0.0-beta5.25279.2</SystemCommandLineVersion>
<TraceEventVersion>3.1.16</TraceEventVersion>
<NETStandardLibraryRefVersion>2.1.0</NETStandardLibraryRefVersion>
<NetStandardLibraryVersion>2.0.3</NetStandardLibraryVersion>
Expand Down
30 changes: 25 additions & 5 deletions src/coreclr/tools/Common/CommandLineHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.CommandLine.Help;
using System.Collections.Generic;
using System.CommandLine.Help;
using System.CommandLine.Invocation;
using System.CommandLine.Parsing;
using System.IO;
using System.IO.Compression;
Expand Down Expand Up @@ -129,15 +130,13 @@
return command;
}

public static RootCommand UseExtendedHelp(this RootCommand command, Func<HelpContext, IEnumerable<Func<HelpContext, bool>>> customizer)
public static RootCommand UseExtendedHelp(this RootCommand command, Action<ParseResult> customizer)
{
foreach (Option option in command.Options)
{
if (option is HelpOption helpOption)
{
HelpBuilder builder = new();
builder.CustomizeLayout(customizer);
helpOption.Action = new HelpAction { Builder = builder };
helpOption.Action = new CustomizedHelpAction(helpOption, customizer);
break;
}
}
Expand Down Expand Up @@ -427,5 +426,26 @@
newTokens = null;
return false;
}

private sealed class CustomizedHelpAction : SynchronousCommandLineAction
{
private readonly HelpAction _helpAction;
private readonly Action<ParseResult> _customizer;

public CustomizedHelpAction(HelpOption helpOption, Action<ParseResult> customizer)
{
_helpAction = (HelpAction)helpOption.Action;
_customizer = customizer;
}

public override int Invoke(ParseResult parseResult)
{
int result = _helpAction(parseResult);

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 debug Mono_Runtime)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 debug Mono_Runtime)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 debug Mono_Runtime)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug AllSubsets_Mono_LLVMAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug AllSubsets_Mono)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug AllSubsets_Mono)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm Debug AllSubsets_Mono)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Release AllSubsets_Mono)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Release AllSubsets_Mono)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Release AllSubsets_Mono_LLVMAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Mono_MiniJIT_LibrariesTests)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_Mono)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Release AllSubsets_Mono_LLVMAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Mono_Interpreter_LibrariesTests)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug NativeAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Mono_MiniJIT_LibrariesTests)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Mono_MiniJIT_LibrariesTests)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Release NativeAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 debug Mono_Runtime)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Release AllSubsets_Mono_Interpreter_RuntimeTests monointerpreter)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Release NativeAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Release NativeAOT_Libraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Release NativeAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Release AllSubsets_Mono_LLVMAot_RuntimeTests llvmaot)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Release AllSubsets_Mono_Minijit_RuntimeTests minijit)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Release AllSubsets_Mono_Minijit_RuntimeTests minijit)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 checked CLR_Tools_Tests)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x86 checked CoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-armel checked CoreCLR_NonPortable)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build Source-Build (Linux_x64))

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm checked CoreCLR_ReleaseLibraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm checked CoreCLR_ReleaseLibraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-x64 Release AllSubsets_CoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_CoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug CoreCLR_Libraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Release NativeAOT_Libraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug AllSubsets_CoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm64 Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build linux-x64 release Runtime_Release)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug CoreCLR_Libraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build ios-arm64 Release AllSubsets_NativeAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug CoreCLR_Libraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug AllSubsets_CoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm64 checked CoreCLR_ReleaseLibraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 checked CoreCLR_ReleaseLibraries)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build osx-x64 release Runtime_Release)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

Check failure on line 443 in src/coreclr/tools/Common/CommandLineHelpers.cs

View check run for this annotation

Azure Pipelines / runtime (Build tvos-arm64 Release AllSubsets_NativeAOT)

src/coreclr/tools/Common/CommandLineHelpers.cs#L443

src/coreclr/tools/Common/CommandLineHelpers.cs(443,30): error CS1955: (NETCORE_ENGINEERING_TELEMETRY=Build) Non-invocable member 'Helpers.CustomizedHelpAction._helpAction' cannot be used like a method.

_customizer(parseResult);

return result;
}
}
}
}
79 changes: 36 additions & 43 deletions src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,64 +329,57 @@ public ILCompilerRootCommand(string[] args) : base(".NET Native IL Compiler")
});
}

public static IEnumerable<Func<HelpContext, bool>> GetExtendedHelp(HelpContext _)
public static void PrintExtendedHelp(ParseResult _)
{
foreach (Func<HelpContext, bool> sectionDelegate in HelpBuilder.Default.GetLayout())
yield return sectionDelegate;
Console.WriteLine("Options may be passed on the command line, or via response file. On the command line switch values may be specified by passing " +
"the option followed by a space followed by the value of the option, or by specifying a : between option and switch value. A response file " +
"is specified by passing the @ symbol before the response file name. In a response file all options must be specified on their own lines, and " +
"only the : syntax for switches is supported.\n");

yield return _ =>
{
Console.WriteLine("Options may be passed on the command line, or via response file. On the command line switch values may be specified by passing " +
"the option followed by a space followed by the value of the option, or by specifying a : between option and switch value. A response file " +
"is specified by passing the @ symbol before the response file name. In a response file all options must be specified on their own lines, and " +
"only the : syntax for switches is supported.\n");

Console.WriteLine("Use the '--' option to disambiguate between input files that have begin with -- and options. After a '--' option, all arguments are " +
"considered to be input files. If no input files begin with '--' then this option is not necessary.\n");
Console.WriteLine("Use the '--' option to disambiguate between input files that have begin with -- and options. After a '--' option, all arguments are " +
"considered to be input files. If no input files begin with '--' then this option is not necessary.\n");

string[] ValidArchitectures = new string[] { "arm", "arm64", "x86", "x64", "riscv64", "loongarch64" };
string[] ValidOS = new string[] { "windows", "linux", "freebsd", "osx", "maccatalyst", "ios", "iossimulator", "tvos", "tvossimulator" };
string[] ValidArchitectures = new string[] { "arm", "arm64", "x86", "x64", "riscv64", "loongarch64" };
string[] ValidOS = new string[] { "windows", "linux", "freebsd", "osx", "maccatalyst", "ios", "iossimulator", "tvos", "tvossimulator" };

Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant());
Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant());

Console.WriteLine(string.Format("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetarch", string.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
Console.WriteLine(string.Format("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetarch", string.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));

Console.WriteLine("The allowable values for the --instruction-set option are described in the table below. Each architecture has a different set of valid " +
"instruction sets, and multiple instruction sets may be specified by separating the instructions sets by a ','. For example 'avx2,bmi,lzcnt'");
Console.WriteLine("The allowable values for the --instruction-set option are described in the table below. Each architecture has a different set of valid " +
"instruction sets, and multiple instruction sets may be specified by separating the instructions sets by a ','. For example 'avx2,bmi,lzcnt'");

foreach (string arch in ValidArchitectures)
foreach (string arch in ValidArchitectures)
{
TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
bool first = true;
foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch))
{
TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
bool first = true;
foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch))
// Only instruction sets with are specifiable should be printed to the help text
if (instructionSet.Specifiable)
{
// Only instruction sets with are specifiable should be printed to the help text
if (instructionSet.Specifiable)
if (first)
{
if (first)
{
Console.Write(arch);
Console.Write(": ");
first = false;
}
else
{
Console.Write(", ");
}
Console.Write(instructionSet.Name);
Console.Write(arch);
Console.Write(": ");
first = false;
}
else
{
Console.Write(", ");
}
Console.Write(instructionSet.Name);
}

if (first) continue; // no instruction-set found for this architecture

Console.WriteLine();
}

if (first) continue; // no instruction-set found for this architecture

Console.WriteLine();
Console.WriteLine("The following CPU names are predefined groups of instruction sets and can be used in --instruction-set too:");
Console.WriteLine(string.Join(", ", Internal.JitInterface.InstructionSetFlags.AllCpuNames));
return true;
};
}

Console.WriteLine();
Console.WriteLine("The following CPU names are predefined groups of instruction sets and can be used in --instruction-set too:");
Console.WriteLine(string.Join(", ", Internal.JitInterface.InstructionSetFlags.AllCpuNames));
}

private static TargetArchitecture MakeTargetArchitecture(ArgumentResult result)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/aot/ILCompiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ private static IEnumerable<int> ProcessWarningCodes(IEnumerable<string> warningC
private static int Main(string[] args) =>
new CommandLineConfiguration(new ILCompilerRootCommand(args)
.UseVersion()
.UseExtendedHelp(ILCompilerRootCommand.GetExtendedHelp))
.UseExtendedHelp(ILCompilerRootCommand.PrintExtendedHelp))
{
ResponseFileTokenReplacer = Helpers.TryReadResponseFile,
EnableDefaultExceptionHandler = false,
Expand Down
99 changes: 46 additions & 53 deletions src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,69 +285,62 @@ public Crossgen2RootCommand(string[] args) : base(SR.Crossgen2BannerText)
});
}

public static IEnumerable<Func<HelpContext, bool>> GetExtendedHelp(HelpContext _)
public static void PrintExtendedHelp(ParseResult _)
{
foreach (Func<HelpContext, bool> sectionDelegate in HelpBuilder.Default.GetLayout())
yield return sectionDelegate;

yield return _ =>
Console.WriteLine(SR.OptionPassingHelp);
Console.WriteLine();
Console.WriteLine(SR.DashDashHelp);
Console.WriteLine();

string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64", "riscv64", "loongarch64"};
string[] ValidOS = new string[] {"windows", "linux", "osx", "ios", "iossimulator", "maccatalyst"};

Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()));
Console.WriteLine();
Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetarch", String.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
Console.WriteLine();
Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--type-validation", String.Join("', '", Enum.GetNames<TypeValidationRule>()), nameof(TypeValidationRule.Automatic)));
Console.WriteLine();

Console.WriteLine(SR.CrossModuleInliningExtraHelp);
Console.WriteLine();
Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--method-layout", String.Join("', '", Enum.GetNames<MethodLayoutAlgorithm>())));
Console.WriteLine();
Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--file-layout", String.Join("', '", Enum.GetNames<FileLayoutAlgorithm>())));
Console.WriteLine();

Console.WriteLine(SR.InstructionSetHelp);
foreach (string arch in ValidArchitectures)
{
Console.WriteLine(SR.OptionPassingHelp);
Console.WriteLine();
Console.WriteLine(SR.DashDashHelp);
Console.WriteLine();

string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64", "riscv64", "loongarch64"};
string[] ValidOS = new string[] {"windows", "linux", "osx", "ios", "iossimulator", "maccatalyst"};

Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()));
Console.WriteLine();
Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetarch", String.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
Console.WriteLine();
Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--type-validation", String.Join("', '", Enum.GetNames<TypeValidationRule>()), nameof(TypeValidationRule.Automatic)));
Console.WriteLine();

Console.WriteLine(SR.CrossModuleInliningExtraHelp);
Console.WriteLine();
Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--method-layout", String.Join("', '", Enum.GetNames<MethodLayoutAlgorithm>())));
Console.WriteLine();
Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--file-layout", String.Join("', '", Enum.GetNames<FileLayoutAlgorithm>())));
Console.WriteLine();

Console.WriteLine(SR.InstructionSetHelp);
foreach (string arch in ValidArchitectures)
TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
bool first = true;
foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch))
{
TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
bool first = true;
foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch))
// Only instruction sets with are specifiable should be printed to the help text
if (instructionSet.Specifiable)
{
// Only instruction sets with are specifiable should be printed to the help text
if (instructionSet.Specifiable)
if (first)
{
if (first)
{
Console.Write(arch);
Console.Write(": ");
first = false;
}
else
{
Console.Write(", ");
}
Console.Write(instructionSet.Name);
Console.Write(arch);
Console.Write(": ");
first = false;
}
else
{
Console.Write(", ");
}
Console.Write(instructionSet.Name);
}

if (first) continue; // no instruction-set found for this architecture

Console.WriteLine();
}

if (first) continue; // no instruction-set found for this architecture

Console.WriteLine();
Console.WriteLine(SR.CpuFamilies);
Console.WriteLine(string.Join(", ", Internal.JitInterface.InstructionSetFlags.AllCpuNames));
return true;
};
}

Console.WriteLine();
Console.WriteLine(SR.CpuFamilies);
Console.WriteLine(string.Join(", ", Internal.JitInterface.InstructionSetFlags.AllCpuNames));
}

private static TargetArchitecture MakeTargetArchitecture(ArgumentResult result)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/aot/crossgen2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ internal static bool IsValidPublicKey(byte[] blob)
private static int Main(string[] args) =>
new CommandLineConfiguration(new Crossgen2RootCommand(args)
.UseVersion()
.UseExtendedHelp(Crossgen2RootCommand.GetExtendedHelp))
.UseExtendedHelp(Crossgen2RootCommand.PrintExtendedHelp))
{
ResponseFileTokenReplacer = Helpers.TryReadResponseFile,
EnableDefaultExceptionHandler = false,
Expand Down
13 changes: 3 additions & 10 deletions src/coreclr/tools/dotnet-pgo/PgoRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,11 @@ int ExecuteWithContext(ParseResult result, bool setVerbosity)
}
}

public static IEnumerable<Func<HelpContext, bool>> GetExtendedHelp(HelpContext context)
public static void PrintExtendedHelp(ParseResult parseResult)
{
foreach (Func<HelpContext, bool> sectionDelegate in HelpBuilder.Default.GetLayout())
yield return sectionDelegate;

if (context.Command.Name == "create-mibc" || context.Command.Name == "create-jittrace")
if (parseResult.CommandResult.Command.Name is "create-mibc" or "create-jittrace")
{
yield return _ =>
{
Console.WriteLine(
Console.WriteLine(
@"Example tracing commands used to generate the input to this tool:
""dotnet-trace collect -p 73060 --providers Microsoft-Windows-DotNETRuntime:0x1E000080018:4""
- Capture events from process 73060 where we capture both JIT and R2R events using EventPipe tracing
Expand All @@ -280,8 +275,6 @@ public static IEnumerable<Func<HelpContext, bool>> GetExtendedHelp(HelpContext c
""perfview collect -LogFile:logOfCollection.txt -DataFile:jittrace.etl -Zip:false -merge:false -providers:Microsoft-Windows-DotNETRuntime:0x1E000080018:4""
- Capture Jit and R2R events via perfview of all processes running using ETW tracing
");
return true;
};
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/dotnet-pgo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public Program(PgoRootCommand command)
private static int Main(string[] args) =>
new CommandLineConfiguration(new PgoRootCommand(args)
.UseVersion()
.UseExtendedHelp(PgoRootCommand.GetExtendedHelp))
.UseExtendedHelp(PgoRootCommand.PrintExtendedHelp))
{
ResponseFileTokenReplacer = Helpers.TryReadResponseFile,
EnableDefaultExceptionHandler = false,
Expand Down
Loading