{"record":{"id":"7a6f59905bdc0cce","repo":"microsoft/aspire","slug":"at-least-one-exporting-assembly-name-is-required","errorCode":null,"errorMessage":"At least one exporting assembly name is required.","messagePattern":"At least one exporting assembly name is required\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.TypeSystem/ApiReferenceExportOptions.cs","lineNumber":52,"sourceCode":"    /// Thrown when <paramref name=\"packageName\"/>, <paramref name=\"packageVersion\"/>, or\n    /// <paramref name=\"exportingAssemblyNames\"/> is <see langword=\"null\"/>.\n    /// </exception>\n    /// <exception cref=\"ArgumentException\">\n    /// Thrown when <paramref name=\"packageName\"/> or <paramref name=\"packageVersion\"/> is empty or\n    /// consists only of white-space characters, or when <paramref name=\"exportingAssemblyNames\"/>\n    /// is empty or contains a null, empty, or white-space assembly name.\n    /// </exception>\n    public ApiReferenceExportOptions(\n        string packageName,\n        string packageVersion,\n        IReadOnlyCollection<string> exportingAssemblyNames)\n    {\n        ArgumentException.ThrowIfNullOrWhiteSpace(packageName);\n        ArgumentException.ThrowIfNullOrWhiteSpace(packageVersion);\n        ArgumentNullException.ThrowIfNull(exportingAssemblyNames);\n        if (exportingAssemblyNames.Count == 0)\n        {\n            throw new ArgumentException(\"At least one exporting assembly name is required.\", nameof(exportingAssemblyNames));\n        }\n        if (exportingAssemblyNames.Any(string.IsNullOrWhiteSpace))\n        {\n            throw new ArgumentException(\"Exporting assembly names cannot be null or white-space.\", nameof(exportingAssemblyNames));\n        }\n\n        PackageName = packageName;\n        PackageVersion = packageVersion;\n        ExportingAssemblyNames = Array.AsReadOnly(exportingAssemblyNames.ToArray());\n    }\n\n    /// <summary>\n    /// Gets the name of the package being exported.\n    /// </summary>\n    public string PackageName { get; }\n\n    /// <summary>\n    /// Gets the version label recorded for this export, as supplied by the caller.","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.TypeSystem/ApiReferenceExportOptions.cs#L34-L70","documentation":"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.","triggerScenarios":"Calling new ApiReferenceExportOptions(packageName, packageVersion, exportingAssemblyNames) with an empty list/array or null for exportingAssemblyNames.","commonSituations":"Building export options programmatically from a filtered/glob result that matched nothing; deserializing export settings from config where the assembly list key was missing.","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"],"exampleFix":"// before\nvar options = new ApiReferenceExportOptions(pkg, ver, []);\n// after\nvar options = new ApiReferenceExportOptions(pkg, ver, [\"Aspire.Hosting\"]);","handlingStrategy":"validation","validationCode":"if (names is null || names.Count == 0)\n    throw new ArgumentException(\"Provide at least one exporting assembly name.\");","typeGuard":null,"tryCatchPattern":"try { var o = new ApiReferenceExportOptions(pkg, ver, names); }\ncatch (ArgumentException ex) { logger.LogError(ex, \"Invalid export options\"); }","preventionTips":["Assert the assembly-discovery step returned results before building options","Validate config-driven assembly lists at startup"],"tags":["api","validation","arguments"],"backgroundTag":"empty-required-field","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}