Ir al contenido

Compiler Warning ASPIREINTERACTION001

Esta página aún no está disponible en tu idioma.

Version introduced: 13.0

Interaction service types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.

This diagnostic warns when using the experimental IInteractionService interface and related interaction APIs. These APIs provide the ability to prompt users for input, request confirmation, and display messages in the Aspire dashboard or CLI during publish and deploy operations.

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
// Using IInteractionService from an IServiceProvider instance
var interactionService = serviceProvider.GetRequiredService<IInteractionService>();
if (interactionService.IsAvailable)
{
var result = await interactionService.PromptConfirmationAsync(
title: "Confirmation",
message: "Are you sure you want to proceed?");
}

The diagnostic is triggered because IInteractionService is marked with the [Experimental("ASPIREINTERACTION001")] attribute.

The IInteractionService interface provides user interaction functionality for Aspire applications:

  • Message display: Show dialogs and notifications in the dashboard
  • User confirmation: Request confirmation before destructive operations
  • Input collection: Prompt users for single or multiple input values
  • Context awareness: Works in both dashboard UI and CLI contexts

This API is experimental because the interaction patterns and API surface may evolve based on usage patterns and feedback from deployment scenarios.

  • IInteractionService: Interface for prompting users and displaying messages
  • InteractionInput: Defines input fields for user prompts
  • InputType: Enum for input field types (Text, SecretText, Choice, Boolean, Number)
  • InputLoadOptions: Configuration for dynamic input loading
  • MessageBoxInteractionOptions: Options for message box dialogs
  • NotificationInteractionOptions: Options for notification messages
  • PromptMessageBoxAsync(): Displays a modal dialog box
  • PromptNotificationAsync(): Displays a non-modal notification
  • PromptConfirmationAsync(): Prompts for user confirmation
  • PromptInputAsync(): Prompts for a single input value
  • PromptInputsAsync(): Prompts for multiple input values

The diagnostic can be suppressed using one of several methods:

.editorconfig
[*.{cs,vb}]
dotnet_diagnostic.ASPIREINTERACTION001.severity = none
YourProject.csproj
<PropertyGroup>
<NoWarn>$(NoWarn);ASPIREINTERACTION001</NoWarn>
</PropertyGroup>
#pragma warning disable ASPIREINTERACTION001
var interactionService = serviceProvider.GetRequiredService<IInteractionService>();
var result = await interactionService.PromptConfirmationAsync(
title: "Confirmation",
message: "Are you sure?");
#pragma warning restore ASPIREINTERACTION001