Compiler Warning ASPIRECONTAINERSHELLEXECUTION001

Version introduced: 9.3

The container shell execution property is experimental and subject to change or removal in future updates. Suppress this diagnostic to proceed.

The ShellExecution property on ContainerResource is an experimental feature that controls whether custom arguments should be wrapped for shell execution. When enabled, custom arguments are wrapped in -c "values" format for shell execution.

Example

The following code generates ASPIRECONTAINERSHELLEXECUTION001:

var builder = DistributedApplication.CreateBuilder(args);
  
var container = builder.AddContainer("mycontainer", "myimage");
container.ShellExecution = true;

To correct this warning

Suppress the warning with either of the following methods:

  • Set the severity of the rule in the .editorconfig file.

    [*.{cs,vb}]
    dotnet_diagnostic.ASPIRECONTAINERSHELLEXECUTION001.severity = none

    For more information about editor config files, see Configuration files for code analysis rules.

  • Add the following PropertyGroup to your project file:

    <PropertyGroup>
        <NoWarn>$(NoWarn);ASPIRECONTAINERSHELLEXECUTION001</NoWarn>
    </PropertyGroup>
  • Suppress in code with the #pragma warning disable ASPIRECONTAINERSHELLEXECUTION001 directive:

    #pragma warning disable ASPIRECONTAINERSHELLEXECUTION001
    container.ShellExecution = true;
    #pragma warning restore ASPIRECONTAINERSHELLEXECUTION001