microsoft/aspire · error · ArgumentNullException
description
Error message
description
What it means
HelmChartDescriptionAnnotation wraps a ReferenceExpression that becomes the Helm chart's description. The primary constructor throws ArgumentNullException when description is null so an annotation with an empty description can never enter the resource model and later break Helm manifest generation.
Solutions
- Pass a valid ReferenceExpression, e.g. ReferenceExpression.Create($"My chart description").
- Skip adding the annotation when you have no description instead of passing null.
- Check the upstream expression-building call for a null return before constructing the annotation.
Example fix
// before annotation = new HelmChartDescriptionAnnotation(null); // after annotation = new HelmChartDescriptionAnnotation(ReferenceExpression.Create($"Payments chart"));
Defensive patterns
Strategy: validation
Validate before calling
if (description is null) return; // skip annotation instead of constructing with null
Prevention
- Build descriptions with ReferenceExpression.Create and never assign null to expression variables.
- Skip annotation registration when no description is available.
When it happens
Trigger: Constructing HelmChartDescriptionAnnotation directly with a null ReferenceExpression, or calling a WithDescription-style extension that forwards a null expression.
Common situations: Developers pass the result of a method that can return null (e.g. a conditional expression or an unassigned ReferenceExpression variable) into the annotation constructor.
Related errors
- Object must be initialized before it can be used
- ArgumentNullException for parameter 'callback' (callback is…
- ArgumentNullException for parameter 'resource' (resource is…
- Cannot derive a Helm release name from resource name
- Cannot derive a Kubernetes namespace from resource name
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/0823e55ba7456db3.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Kubernetes/Annotations/HelmChartDescriptionAnnotation.cs:18
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Aspire.Hosting.ApplicationModel;
namespace Aspire.Hosting.Kubernetes;
/// <summary>
/// An annotation placed on a <see cref="KubernetesEnvironmentResource"/> that specifies
/// the Helm chart description written to the generated <c>Chart.yaml</c>.
/// </summary>
/// <param name="description">A <see cref="ReferenceExpression"/> representing the chart description value.</param>
public sealed class HelmChartDescriptionAnnotation(ReferenceExpression description) : IResourceAnnotation
{
/// <summary>
/// Gets the Helm chart description as a <see cref="ReferenceExpression"/>.
/// </summary>
public ReferenceExpression Description { get; } = description ?? throw new ArgumentNullException(nameof(description));
}
View on GitHub (pinned to 25830f84bd)