MudBlazor/MudBlazor · error · ArgumentException
The category name cannot be null nor empty.
Error message
The category name cannot be null nor empty.
What it means
Thrown by the CategoryAttribute constructor when its name argument is null or an empty string. Every MudBlazor component parameter annotated with [Category(...)] must pass a non-empty category name; the attribute is applied at attribute-instantiation time (i.e. when the type is loaded/reflected), so this is a compile-time/authoring error surfacing at runtime reflection or in the docs API generator.
Source
Thrown at src/MudBlazor/Attributes/CategoryAttribute.cs:19
using MudBlazor.Charts;
namespace MudBlazor
{
/// <summary>
/// Groups a MudBlazor component parameter under a named category on its API documentation page.
/// </summary>
/// <remarks>
/// Use this attribute together with the <see cref="Microsoft.AspNetCore.Components.ParameterAttribute"/>. <br/>
/// This attribute is similar to <see cref="System.ComponentModel.CategoryAttribute"/>. <br/>
/// The name of the category can be specified by using a constant defined in the <see cref="CategoryTypes"/> class.
/// </remarks>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class CategoryAttribute : Attribute
{
public CategoryAttribute(string name)
{
if (string.IsNullOrEmpty(name))
throw new ArgumentException("The category name cannot be null nor empty.");
if (!_categoryOrder.ContainsKey(name))
throw new ArgumentException($"The given category name '{name}' isn't in the categoryOrder field.");
Name = name;
}
/// <summary> The name of the category. </summary>
public string Name { get; }
/// <summary> The order of the category - the greater the number the lower the category will be displayed in the API documentation. </summary>
public int Order => _categoryOrder[Name];
// Possible categories of component properties and the order in which they are displayed in the API documentation.
private static readonly Dictionary<string, int> _categoryOrder = new()
{
["Data"] = 0, // general category
["Validation"] = 1, // general category
// specific categories associated with dataView on GitHub (pinned to bdb3acd5dd)
Solutions
- Provide a non-empty category name, preferably a constant from CategoryTypes (e.g. CategoryTypes.Button.Appearance).
- Search the codebase for Category("") / Category(null) and fix the offending attribute.
- If you genuinely need no category, simply omit the [Category] attribute.
Example fix
// before
[Parameter]
[Category("")]
public bool Dense { get; set; }
// after
[Parameter]
[Category(CategoryTypes.Button.Appearance)]
public bool Dense { get; set; } Defensive patterns
Strategy: validation
Validate before calling
var name = CategoryTypes.Button.Appearance;
if (string.IsNullOrEmpty(name))
throw new InvalidOperationException("Category name must not be empty."); Prevention
- Always source category names from the CategoryTypes constants rather than typing literals.
- Run a solution-wide search for Category("") / Category(null) after refactors.
- Treat the [Category] attribute as required-on-every-parameter within MudBlazor component authoring.
When it happens
Trigger: Writing [Category("")] or [Category(null)] on a MudBlazor component parameter, or computing the name from an expression that resolves to empty (e.g. [Category(SomeConstant)] where the constant is empty).
Common situations: Authoring a custom component that inherits MudComponentBase and copying a [Category] attribute without filling in the name; refactor that leaves a placeholder; build of the docs API table reflecting such a property.
Related errors
- The given category name '{name}' isn't in the categoryOrder
- [MudBlazor] MudExitPrompt: Prompt with id '${id}' is not reg
- Interpolation option not implemented yet
- All nodes must have unique names
- Edge {edgeWithInvalidNode.Source} {ChartOptions!.EdgeLabelSy
AI-assisted analysis of MudBlazor/MudBlazor@bdb3acd5dd (2026-08-13).
Data as JSON: /api/errors/3cc0f7b0b6b21264.
Report an issue: GitHub.