microsoft / microsoft/aspire

`WithServerAuthenticationCertificateConfiguration` should allow args & env vars `ReferenceExpression`s to be specified as inline interpolated stringin

Open
#13,120 0 comments 0 reactions 0 assignees View on GitHub
area-app-model
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 12h
Merged PRs (30d)
201

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

When adding arguments within `WithServerAuthenticationCertificateConfiguration`, I tried to do the following, expecting it to behave the same way as `WithArgs()`

```
ctx.Arguments.Add($@"--config=yaml:receivers::otlp::protocols::http::tls::cert_file: ""{ctx.CertificatePath}""");
```

However method treats the interpolated string a a string, rather than a reference expression, so incorrectly ends up as
```
--config=yaml:receivers::otlp::protocols::http::tls::cert_file: "Aspire.Hosting.ApplicationModel.ReferenceExpression",
```

Note how the path ends up as `Aspire.Hosting.ApplicationModel.ReferenceExpression` rather than `/path/to/cert`.

### Describe the solution you'd like

I'd like `ctx.Arguments.Add` to behav like `WithArgs()`, with inline interpolated strings automatically becoming `ReferenceExpression`s.

Alternatively #10970 could be implemented in a way that an incorrect interpolated string would fail fast. `WithServerAuthenticationCertificateConfiguration` is an advanced API, so users having to wrap their expression in `ReferenceExpression.Create()` isn't the end of the world, if the raw interpolated string fails clearly and obviously.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by comparing WithServerAuthenticationCertificateConfiguration and WithArgs, focusing on how ctx.Arguments.Add handles interpolated strings and ReferenceExpressions. Reproduce the certificate-path example, then verify that inline interpolated strings resolve to the path rather than the ReferenceExpression type name, or that unsupported usage fails clearly; ReferenceExpression.Create is the stated alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.