Cryptic Error when ReferenceExpression
value looks like a JSON object
#7030
Labels
untriaged
New issue has not been triaged
Is there an existing issue for this?
Describe the bug
If you try to create a reference expression encapsulating another expression in a json value (e.g.
ReferenceExpression.Create($@"{{""url"": ""{app.GetEndpoint("http")}""}}
), your resoruce will fail to start with a cryptic error ofFailed to apply configuration value 'JsonifiedReference'. A dependency may have failed to start.
Further investigation suggested the root cause is an escaping problem, however aspire only logs the error at debug level, so you probably don't see the inner exception making determining the root cause a pain.
aspire/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs
Line 1399 in 4494825
aspire/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs
Line 1676 in 4494825
aspire/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs
Line 1357 in 4494825
aspire/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs
Line 1746 in 4494825
Expected Behavior
I'd have expected aspire to provide a clearer error that would have let me work out the issue was due to escaping, not a
Steps To Reproduce
For a more real world repo
A simpler repo can be seen with
Exceptions (if any)
If you turn on debug logging, you'll see an error more like:
.NET Version info
Anything else?
The text was updated successfully, but these errors were encountered: