{"record":{"id":"5c1f7c102eb6b8ed","repo":"microsoft/aspire","slug":"value-cannot-be-null-parameter-iconname","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'iconName')","messagePattern":"Value cannot be null\\. \\(Parameter 'iconName'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/ApplicationModel/ResourceIconAnnotation.cs","lineNumber":23,"sourceCode":"\nnamespace Aspire.Hosting.ApplicationModel;\n\n/// <summary>\n/// Specifies the icon to use when displaying a resource in the dashboard.\n/// </summary>\n/// <param name=\"iconName\">The name of the FluentUI icon to use.</param>\n/// <param name=\"iconVariant\">The variant of the icon (Regular or Filled).</param>\n[DebuggerDisplay(\"Type = {GetType().Name,nq}, IconName = {IconName}, IconVariant = {IconVariant}\")]\npublic sealed class ResourceIconAnnotation(string iconName, IconVariant iconVariant = IconVariant.Filled) : IResourceAnnotation\n{\n    /// <summary>\n    /// Gets the name of the FluentUI icon to use for the resource.\n    /// </summary>\n    /// <remarks>\n    /// The icon name should be a valid FluentUI icon name. \n    /// See https://aka.ms/fluentui-system-icons for available icons.\n    /// </remarks>\n    public string IconName { get; } = iconName ?? throw new ArgumentNullException(nameof(iconName));\n\n    /// <summary>\n    /// Gets the variant of the icon (Regular or Filled).\n    /// </summary>\n    public IconVariant IconVariant { get; } = iconVariant;\n}","sourceCodeStart":5,"sourceCodeEnd":29,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/ApplicationModel/ResourceIconAnnotation.cs#L5-L29","documentation":"Primary constructor null guard in ResourceIconAnnotation: the 'iconName' string is null. iconName is a non-nullable positional parameter, so the runtime ArgumentNullException fires before the annotation is created; iconVariant has a default and is never the faulting input.","triggerScenarios":"Constructing new ResourceIconAnnotation(iconName: null, ...) directly or from a .WithIcon-style helper passing a null icon name.","commonSituations":"Reading an icon name from config or a constant that resolves to null; conditional icon assignment where a variable is uninitialized.","solutions":["Pass a valid FluentUI system icon name (see https://aka.ms/fluentui-system-icons)","Guard nulls before constructing the annotation and skip or substitute a default icon","Fix the config source so a real icon name is provided"],"exampleFix":"// before\nnew ResourceIconAnnotation(iconName, IconVariant.Regular); // iconName is null\n// after\nnew ResourceIconAnnotation(iconName ?? \"Database\", IconVariant.Regular);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(iconName)) iconName = \"Database\"; // FluentUI default","typeGuard":null,"tryCatchPattern":"try { var ann = new ResourceIconAnnotation(iconName, variant); }\ncatch (ArgumentNullException) { /* supply a default icon name */ }","preventionTips":["Source icon names from validated constants, not raw config","Check https://aka.ms/fluentui-system-icons for valid names"],"tags":["aspire","null-argument","annotations"],"backgroundTag":"null-argument","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"}