Skip to content

WithCustomInput example should include #pragma warning disable for preview API #395

@maddymontaquila

Description

@maddymontaquila

Type of issue

Missing information

Description

The external parameters docs show a code example using WithCustomInput, but the example doesn't include the required #pragma warning disable ASPIREINTERACTION001 pragma.

Without it, the compiler emits:

warning ASPIREINTERACTION001: Type is for evaluation purposes only and is subject to change or removal in future updates.

This is a blocker for developers (especially those using TreatWarningsAsErrors) and for AI coding agents who don't know to add the pragma.

Suggested fix

Add the pragma to the example:

#pragma warning disable ASPIREINTERACTION001
var externalServiceUrl = builder.AddParameter("external-service-url")
    .WithDescription("The URL of the external service.")
    .WithCustomInput(p => new()
    {
        InputType = InputType.Text,
        Value = "https://example.com",
        Name = p.Name,
        Placeholder = $"Enter value for {p.Name}",
        Description = p.Description
    });
#pragma warning restore ASPIREINTERACTION001

Also consider adding a note explaining:

  • This is a preview API (link to tracking issue for stable release if one exists)
  • The warning code ASPIREINTERACTION001 and what it means
  • That WithDescription does NOT require the pragma — only WithCustomInput does

Page URL

https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/external-parameters#prompt-for-parameter-values-in-the-dashboard

Content source URL

https://github.com/microsoft/aspire.dev/blob/main/docs/fundamentals/external-parameters.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions