microsoft/aspire · error · ArgumentException
At least one exporting assembly name is required.
Error message
At least one exporting assembly name is required.
What it means
The ApiReferenceExportOptions constructor validates its inputs and throws when the exportingAssemblyNames collection is empty (or null). Export options must name at least one assembly to export API references from.
Solutions
- Pass a non-empty collection of exporting assembly names
- Check the upstream filter/glob that produced the list — it likely matched zero assemblies
- Validate the config file or script that supplies assembly names before constructing options
Example fix
// before var options = new ApiReferenceExportOptions(pkg, ver, []); // after var options = new ApiReferenceExportOptions(pkg, ver, ["Aspire.Hosting"]);
Defensive patterns
Strategy: validation
Validate before calling
if (names is null || names.Count == 0)
throw new ArgumentException("Provide at least one exporting assembly name."); Try / catch
try { var o = new ApiReferenceExportOptions(pkg, ver, names); }
catch (ArgumentException ex) { logger.LogError(ex, "Invalid export options"); } Prevention
- Assert the assembly-discovery step returned results before building options
- Validate config-driven assembly lists at startup
When it happens
Trigger: Calling new ApiReferenceExportOptions(packageName, packageVersion, exportingAssemblyNames) with an empty list/array or null for exportingAssemblyNames.
Common situations: Building export options programmatically from a filtered/glob result that matched nothing; deserializing export settings from config where the assembly list key was missing.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Exporting assembly names cannot be null or white-space.
- 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/7a6f59905bdc0cce.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.TypeSystem/ApiReferenceExportOptions.cs:52
/// Thrown when <paramref name="packageName"/>, <paramref name="packageVersion"/>, or
/// <paramref name="exportingAssemblyNames"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="ArgumentException">
/// 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.View on GitHub (pinned to 25830f84bd)