Compiler Warning ASPIREINTERACTION001
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.
Example generating diagnostic
Section titled “Example generating diagnostic”var builder = DistributedApplication.CreateBuilder(args);
// Using IInteractionService from an IServiceProvider instancevar 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.
Understanding the diagnostic
Section titled “Understanding the diagnostic”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.
Related types
Section titled “Related types”IInteractionService: Interface for prompting users and displaying messagesInteractionInput: Defines input fields for user promptsInputType: Enum for input field types (Text, SecretText, Choice, Boolean, Number)InputLoadOptions: Configuration for dynamic input loadingMessageBoxInteractionOptions: Options for message box dialogsNotificationInteractionOptions: Options for notification messagesPromptMessageBoxAsync(): Displays a modal dialog boxPromptNotificationAsync(): Displays a non-modal notificationPromptConfirmationAsync(): Prompts for user confirmationPromptInputAsync(): Prompts for a single input valuePromptInputsAsync(): Prompts for multiple input values
Suppressing the diagnostic
Section titled “Suppressing the diagnostic”The diagnostic can be suppressed using one of several methods:
Suppressing in .editorconfig
Section titled “Suppressing in .editorconfig”[*.{cs,vb}]dotnet_diagnostic.ASPIREINTERACTION001.severity = noneSuppressing in a project file
Section titled “Suppressing in a project file”title: ASPIREINTERACTION001description: The interaction service APIs are experimental and subject to change.---
## Overview
| Property | Value ||----------|-------|| **Diagnostic ID** | ASPIREINTERACTION001 || **Severity** | Warning || **Category** | Usage |
The `IInteractionService` and related APIs are experimental features that enable interactive prompts and confirmations during AppHost execution. These APIs may change or be removed in future versions.
## Cause
This warning appears when you use the interaction service APIs such as:
- `IInteractionService.PromptAsync`- `IInteractionService.ConfirmAsync`- `IInteractionService.SelectAsync`- `InputGeneratorAnnotation`
## How to suppress
If you understand the experimental nature of these APIs and want to use them, suppress the warning:
```csharp title="Suppress in code"#pragma warning disable ASPIREINTERACTION001var result = await interactionService.PromptAsync("Enter value:", cancellationToken);#pragma warning restore ASPIREINTERACTION001Or in your project file:
<PropertyGroup> <NoWarn>$(NoWarn);ASPIREINTERACTION001</NoWarn></PropertyGroup>Suppressing in source code
Section titled “Suppressing in source code”#pragma warning disable ASPIREINTERACTION001var interactionService = serviceProvider.GetRequiredService<IInteractionService>();var result = await interactionService.PromptConfirmationAsync( title: "Confirmation", message: "Are you sure?");#pragma warning restore ASPIREINTERACTION001See also
Section titled “See also”- Interaction service - Learn how to use the interaction service