Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions src/Cli/dotnet-aot/dotnet-aot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<DefineConstants>$(DefineConstants);DotnetCsproj;CLI_AOT</DefineConstants>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Can toggle this on to get an inventory of dependencies that don't explicitly mark AOT support -->
<!-- <VerifyReferenceAotCompatibility>true</VerifyReferenceAotCompatibility> -->

<!-- Strong naming deprecated on .NET Core -->
<NoWarn>$(NoWarn);CS8002</NoWarn>
Expand Down
12 changes: 1 addition & 11 deletions src/Cli/dotnet/CommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#nullable disable

using System.CommandLine;
#if !CLI_AOT
using Microsoft.DotNet.Cli.Extensions;
#endif

namespace Microsoft.DotNet.Cli;

Expand All @@ -17,19 +15,11 @@ public abstract class CommandBase
protected CommandBase(ParseResult parseResult)
{
_parseResult = parseResult;
#if !CLI_AOT
ShowHelpOrErrorIfAppropriate(parseResult);
#endif
parseResult.ShowHelpOrErrorIfAppropriate();
}

protected CommandBase() { }

#if !CLI_AOT
protected virtual void ShowHelpOrErrorIfAppropriate(ParseResult parseResult)
{
parseResult.ShowHelpOrErrorIfAppropriate();
}
#endif

public abstract int Execute();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ internal class ReferenceListCommand : CommandBase<ListReferenceCommandDefinition
public ReferenceListCommand(ParseResult parseResult)
: base(parseResult)
{
ShowHelpOrErrorIfAppropriate(parseResult);

_fileOrDirectory = Definition.GetFileOrDirectory(parseResult) ?? Directory.GetCurrentDirectory();
}

Expand Down
6 changes: 1 addition & 5 deletions src/Cli/dotnet/Extensions/ParseResultExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ public static bool IsDotnetBuiltInCommand(this ParseResult parseResult) =>
string.IsNullOrEmpty(parseResult.RootSubCommandResult())
|| Parser.GetBuiltInCommand(parseResult.RootSubCommandResult()) != null;

#if !CLI_AOT

public static void ShowHelpOrErrorIfAppropriate(this ParseResult parseResult)
{
if (parseResult.Errors.Any())
Expand Down Expand Up @@ -233,6 +231,7 @@ public static IEnumerable<string> GetRunCommandPropertyValues(this ParseResult p
}
}

#if !CLI_AOT
[Conditional("DEBUG")]
public static void HandleDebugSwitch(this ParseResult parseResult)
{
Expand All @@ -255,15 +254,12 @@ public static string GetCommandName(this ParseResult parseResult)
}
parentNames.Reverse();

#if !CLI_AOT
// Options that perform terminating actions are considered part of the command name as they are essentially subcommands themselves.
// Example: dotnet --version
if (parseResult.Action is InvocableOptionAction { Terminating: true } optionAction)
{
parentNames.Add(optionAction.Option.Name);
}
#endif

return string.Join(' ', parentNames);
}
}
2 changes: 0 additions & 2 deletions src/Cli/dotnet/Installer/Windows/InstallRequestMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ public string WorkloadSetVersion
/// </summary>
/// <param name="bytes">The array of bytes to convert.</param>
/// <returns>An <see cref="InstallRequestMessage"/>.</returns>
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Newtonsoft.Json is not used in AOT scenarios.")]
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Newtonsoft.Json is not used in trimmed scenarios.")]
public static InstallRequestMessage Create(byte[] bytes)
{
string json = Encoding.UTF8.GetString(bytes);
Expand Down
4 changes: 0 additions & 4 deletions src/Cli/dotnet/Installer/Windows/MsiPackageCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ internal class MsiPackageCache(
/// <param name="packageId">The ID of the workload pack package containing an MSI.</param>
/// <param name="packageVersion">The package version.</param>
/// <param name="manifestPath">The JSON manifest associated with the workload pack MSI.</param>
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Newtonsoft.Json is not used in AOT scenarios.")]
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Newtonsoft.Json is not used in trimmed scenarios.")]
public void CachePayload(string packageId, string packageVersion, string manifestPath)
{
if (!File.Exists(manifestPath))
Expand Down Expand Up @@ -133,8 +131,6 @@ public bool TryGetPayloadFromCache(string packageId, string packageVersion, out
return true;
}

[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Newtonsoft.Json is not used in AOT scenarios.")]
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Newtonsoft.Json is not used in trimmed scenarios.")]
public bool TryGetMsiPathFromPackageData(string packageDataPath, [NotNullWhen(true)] out string? msiPath, out string manifestPath)
{
msiPath = default;
Expand Down
2 changes: 0 additions & 2 deletions src/Cli/dotnet/Installer/Windows/MsiPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public IEnumerable<RelatedProduct> RelatedProducts
/// <summary>
/// The manifest data describing the associated MSI.
/// </summary>
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Newtonsoft.Json is not used in AOT scenarios.")]
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Newtonsoft.Json is not used in trimmed scenarios.")]
public MsiManifest Manifest
{
Comment on lines 65 to 69
get
Expand Down
Loading