microsoft/aspire · error · ArgumentNullException
Value cannot be null. (Parameter 'value')
Error message
Value cannot be null. (Parameter 'value')
What it means
PipelineSummaryItem's constructor throws ArgumentNullException with parameter name 'value' when the summary item value string is null. Value is a get-only property assigned with an inline null guard, so construction with a null value fails at the call site. An empty string is allowed; only null is rejected.
Solutions
- Pass a non-null value string, using string.Empty if intentionally blank.
- Coalesce nulls before construction: value ?? "<not available>".
- Ensure the data the value is derived from is resolved before creating the summary item.
Example fix
// before
var item = new PipelineSummaryItem("URL", endpointUrl);
// after
var item = new PipelineSummaryItem("URL", endpointUrl ?? "<not available>"); Defensive patterns
Strategy: validation
Validate before calling
if (value is null)
{
value = "<not available>";
} Try / catch
try
{
var item = new PipelineSummaryItem(key, value);
}
catch (ArgumentNullException ex) when (ex.ParamName == "value")
{
logger.LogWarning("Summary value for '{Key}' was null; skipping item.", key);
} Prevention
- Coalesce nullable values with ?? "<not available>" before constructing.
- Resolve endpoints/outputs before summarizing.
- Treat empty string as the blank-value convention instead of null.
When it happens
Trigger: Calling new PipelineSummaryItem(key, null) or new PipelineSummaryItem(key, null, enableMarkdown) — e.g. a computed endpoint URL, status, or output that ended up null.
Common situations: A pipeline step summarizes a resource whose property (URL, connection string, deployment output) was not yet available and the null value flows into the constructor.
Related errors
- Value cannot be null. (Parameter 'key')
- Cannot complete step: Reporter is not set.
- Cannot create task: Reporter is not set.
- ArgumentNullException for parameter 'callback' (callback is…
- ArgumentNullException for parameter 'resource' (resource is…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/02f88c883088f8fc.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting/Pipelines/PipelineSummaryItem.cs:26
/// <summary>
/// Represents a single item in a <see cref="PipelineSummary"/>, consisting of a key, a value,
/// and a flag indicating whether the value contains Markdown formatting.
/// </summary>
/// <param name="key">The key or label for the summary item.</param>
/// <param name="value">The string value for the summary item.</param>
/// <param name="enableMarkdown">Whether the <paramref name="value"/> contains Markdown formatting.</param>
[Experimental("ASPIREPIPELINES001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public sealed class PipelineSummaryItem(string key, string value, bool enableMarkdown)
{
/// <summary>
/// Gets the key or label for the summary item (e.g., "Namespace", "URL").
/// </summary>
public string Key { get; } = key ?? throw new ArgumentNullException(nameof(key));
/// <summary>
/// Gets the string value for the summary item.
/// </summary>
public string Value { get; } = value ?? throw new ArgumentNullException(nameof(value));
/// <summary>
/// Gets a value indicating whether <see cref="Value"/> contains Markdown formatting that
/// should be rendered by the CLI output.
/// </summary>
public bool EnableMarkdown { get; } = enableMarkdown;
}
View on GitHub (pinned to 25830f84bd)