-
Notifications
You must be signed in to change notification settings - Fork 42
Add ASPIREINTERACTION001 diagnostics article for IInteractionService #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
23c8938
Initial plan
Copilot ec1cfdb
Add ASPIREINTERACTION001 diagnostics article for IInteractionService
Copilot b2fafc5
Address code review feedback for ASPIREINTERACTION001 article
Copilot 03813ac
Fix grammar error in ASPIREINTERACTION001 diagnostic description
Copilot d335623
Replace BuildServiceProvider anti-pattern with IServiceProvider in co…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/frontend/src/content/docs/diagnostics/aspireinteraction001.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| --- | ||
| title: Compiler Warning ASPIREINTERACTION001 | ||
| description: Learn more about compiler Warning ASPIREINTERACTION001. Interaction service types and members are for evaluation purposes only and are subject to change or removal in future updates. | ||
| --- | ||
|
|
||
| import { Badge } from '@astrojs/starlight/components'; | ||
|
|
||
| <Badge text="Version introduced: 13.0" variant="note" size="large" class:list={'mb-1'} /> | ||
|
|
||
| > 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 | ||
|
|
||
| ```csharp title="AppHost.cs" | ||
| var builder = DistributedApplication.CreateBuilder(args); | ||
|
|
||
| // Using IInteractionService from an IServiceProvider instance | ||
| var interactionService = serviceProvider.GetRequiredService<IInteractionService>(); | ||
IEvangelist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
|
|
||
| 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 | ||
|
|
||
| - **`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 | ||
|
|
||
| ## Suppressing the diagnostic | ||
|
|
||
| The diagnostic can be suppressed using one of several methods: | ||
|
|
||
| ### Suppressing in .editorconfig | ||
IEvangelist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```ini title=".editorconfig" | ||
| [*.{cs,vb}] | ||
| dotnet_diagnostic.ASPIREINTERACTION001.severity = none | ||
| ``` | ||
|
|
||
| ### Suppressing in a project file | ||
|
|
||
| ```xml title="YourProject.csproj" | ||
| <PropertyGroup> | ||
| <NoWarn>$(NoWarn);ASPIREINTERACTION001</NoWarn> | ||
| </PropertyGroup> | ||
| ``` | ||
|
|
||
| ### Suppressing in source code | ||
|
|
||
| ```csharp | ||
| #pragma warning disable ASPIREINTERACTION001 | ||
| var interactionService = serviceProvider.GetRequiredService<IInteractionService>(); | ||
| var result = await interactionService.PromptConfirmationAsync( | ||
| title: "Confirmation", | ||
| message: "Are you sure?"); | ||
| #pragma warning restore ASPIREINTERACTION001 | ||
| ``` | ||
|
|
||
| ## See also | ||
|
|
||
| - [Interaction service (Preview)](/extensibility/interaction-service/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.