Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Compiler Warning ASPIREUSERSECRETS001
seoTitle: "ASPIREUSERSECRETS001: The user secrets manager APIs are"
seoTitle: 'ASPIREUSERSECRETS001 before Aspire 17.0'
description: Learn what causes the Aspire compiler warning ASPIREUSERSECRETS001 — the user secrets manager APIs are experimental and subject to change.
---

Expand All @@ -13,9 +13,13 @@ import { Badge } from '@astrojs/starlight/components';
class:list={'mb-1'}
/>

> User secrets manager types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.
> Before Aspire 17.0, `IUserSecretsManager` and `IDistributedApplicationBuilder.UserSecretsManager` were for evaluation purposes only and subject to change or removal in future updates, and using them required suppressing this diagnostic.

This diagnostic warning is reported when using the experimental `IUserSecretsManager` interface and related user secrets management APIs. These APIs provide centralized management of user secrets for Aspire applications, enabling secure storage and retrieval of sensitive configuration values.
This diagnostic warning was reported when using the experimental `IUserSecretsManager` interface and related user secrets management APIs. These APIs provide centralized management of user secrets for Aspire applications, enabling secure storage and retrieval of sensitive configuration values.

:::note
`IUserSecretsManager` and `IDistributedApplicationBuilder.UserSecretsManager` have graduated from experimental in Aspire 17.0 and no longer require suppressing this diagnostic.
:::

The `IUserSecretsManager` interface provides user secrets management functionality for Aspire:

Expand All @@ -24,11 +28,9 @@ The `IUserSecretsManager` interface provides user secrets management functionali
- **Configuration integration**: Automatically populate configuration from secrets
- **State management**: Support for saving deployment state to user secrets

This API is experimental because the user secrets management strategy is being refined based on security requirements and usage patterns, and the interface may evolve to support additional secret management scenarios.

## Example

The following code generates `ASPIREUSERSECRETS001`:
Before Aspire 17.0, the following code generated `ASPIREUSERSECRETS001`:

```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);
Expand All @@ -51,7 +53,9 @@ bool success = userSecretsManager.TrySetSecret("MySecret", "SecretValue");

## To correct this warning

Suppress the warning with either of the following methods:
If you use Aspire 17.0 or later, you don't need to suppress this diagnostic and can remove any existing `ASPIREUSERSECRETS001` suppressions.

If you use an Aspire version earlier than 17.0, suppress the warning with one of the following methods:

- Set the severity of the rule in the _.editorconfig_ file.

Expand All @@ -70,11 +74,4 @@ Suppress the warning with either of the following methods:
</PropertyGroup>
```

- Suppress in code with the `#pragma warning disable ASPIREUSERSECRETS001` directive:

```csharp title="Suppressing the warning"
#pragma warning disable ASPIREUSERSECRETS001
var userSecretsManager = builder.UserSecretsManager;
bool success = userSecretsManager.TrySetSecret("MySecret", "SecretValue");
#pragma warning restore ASPIREUSERSECRETS001
```
- Suppress in code with the `#pragma warning disable ASPIREUSERSECRETS001` directive.
16 changes: 16 additions & 0 deletions src/frontend/src/content/docs/whats-new/aspire-17.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ Once Aspire 17.0 is available on the stable channel, use the [`aspire update` co
CLI](/get-started/install-cli/).
</LearnMore>

## 🔐 User secrets manager APIs are stable

The `IUserSecretsManager` interface and `IDistributedApplicationBuilder.UserSecretsManager` property have graduated from experimental to stable. You can use them in your AppHost without suppressing `ASPIREUSERSECRETS001`:

```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);
IUserSecretsManager userSecrets = builder.UserSecretsManager;
```

Signatures, defaults, and behavior are unchanged, including persistence semantics, file-path resolution, and `TryDeleteSecret`'s default `false` return value.

<LearnMore>
See [ASPIREUSERSECRETS001](/diagnostics/aspireusersecrets001/) for details on
the diagnostic that no longer applies.
</LearnMore>

## ⚠️ Breaking changes

<span id="breaking-changes"></span>
Expand Down
Loading