microsoft/aspire · error · ArgumentException
Exporting assembly names cannot be null or white-space.
Error message
Exporting assembly names cannot be null or white-space.
What it means
ApiReferenceExportOptions validates that every entry in exportingAssemblyNames is a non-null, non-whitespace string and throws ArgumentException otherwise. It rejects partially-invalid collections rather than silently dropping bad entries.
Solutions
- Remove null/blank entries from the collection before constructing options
- If parsing a delimited string, split then filter with Where(n => !string.IsNullOrWhiteSpace(n))
- Fix the source data (config/CLI input) that produced blank names
Example fix
// before
new ApiReferenceExportOptions(pkg, ver, raw.Split(','));
// after
new ApiReferenceExportOptions(pkg, ver, raw.Split(',').Where(n => !string.IsNullOrWhiteSpace(n)).ToArray()); Defensive patterns
Strategy: validation
Validate before calling
var clean = raw.Where(n => !string.IsNullOrWhiteSpace(n)).ToArray();
if (clean.Length == 0) throw new ArgumentException("No valid assembly names."); Try / catch
try { var o = new ApiReferenceExportOptions(pkg, ver, rawNames); }
catch (ArgumentException ex) { logger.LogError(ex, "Blank assembly name in export options"); } Prevention
- Filter/split delimited assembly lists defensively
- Trim names when building lists from free-form input
When it happens
Trigger: Passing a collection containing null, empty, or whitespace-only assembly names to new ApiReferenceExportOptions.
Common situations: Assembly lists assembled by splitting a comma-separated string with empty items (e.g. "A,,B"), or nulls introduced by deserialization of sparse arrays.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- At least one exporting assembly name is required.
- Array params contains empty item
- Endpoint option ' ' is configured more than once.
- Endpoint option names cannot be empty.
- Endpoint options cannot contain null values.
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/894f9f0b2f4c430e.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.TypeSystem/ApiReferenceExportOptions.cs:56
/// Thrown when <paramref name="packageName"/> or <paramref name="packageVersion"/> is empty or
/// consists only of white-space characters, or when <paramref name="exportingAssemblyNames"/>
/// is empty or contains a null, empty, or white-space assembly name.
/// </exception>
public ApiReferenceExportOptions(
string packageName,
string packageVersion,
IReadOnlyCollection<string> exportingAssemblyNames)
{
ArgumentException.ThrowIfNullOrWhiteSpace(packageName);
ArgumentException.ThrowIfNullOrWhiteSpace(packageVersion);
ArgumentNullException.ThrowIfNull(exportingAssemblyNames);
if (exportingAssemblyNames.Count == 0)
{
throw new ArgumentException("At least one exporting assembly name is required.", nameof(exportingAssemblyNames));
}
if (exportingAssemblyNames.Any(string.IsNullOrWhiteSpace))
{
throw new ArgumentException("Exporting assembly names cannot be null or white-space.", nameof(exportingAssemblyNames));
}
PackageName = packageName;
PackageVersion = packageVersion;
ExportingAssemblyNames = Array.AsReadOnly(exportingAssemblyNames.ToArray());
}
/// <summary>
/// Gets the name of the package being exported.
/// </summary>
public string PackageName { get; }
/// <summary>
/// Gets the version label recorded for this export, as supplied by the caller.
/// </summary>
/// <remarks>
/// Consumers key published documentation on this value, so callers are expected to pass the
/// exact version that was restored. Nothing on this type can confirm that: an exporter seesView on GitHub (pinned to 25830f84bd)