MudBlazor/MudBlazor · error · NotImplementedException

{ChartType} chart is not supported

Error message

{ChartType} chart is not supported

What it means

MudChart.razor.cs maps ChartType to the corresponding options type (PieChartOptions, BarChartOptions, etc.) in a switch expression inside the chart options resolver. All declared ChartType members are mapped, so the NotImplementedException is a defensive guard against an out-of-range or unrecognized ChartType value. It is the options-side counterpart to the render-side throw at error 23.

Source

Thrown at src/MudBlazor/Components/Chart/MudChart.razor.cs:125

        ChartType.Sankey => (SankeyChartOptions)options,
        ChartType.ScatterPlot => (ScatterPlotChartOptions)options,
        _ => ChartOptions!
    };

    private IChartOptions GetDefaultOptionsForChart() => ChartType switch
    {
        ChartType.Pie => new PieChartOptions(),
        ChartType.Bar => new BarChartOptions(),
        ChartType.Line => new LineChartOptions(),
        ChartType.Donut => new DonutChartOptions(),
        ChartType.HeatMap => new HeatMapChartOptions(),
        ChartType.StackedBar => new StackedBarChartOptions(),
        ChartType.Timeseries => new TimeSeriesChartOptions(),
        ChartType.Rose => new RoseChartOptions(),
        ChartType.Radar => new RadarChartOptions(),
        ChartType.Sankey => new SankeyChartOptions(),
        ChartType.ScatterPlot => new ScatterPlotChartOptions(),
        _ => throw new NotImplementedException($"{ChartType} chart is not supported")
    };

    public override void RebuildChart() => ChartReference?.RebuildChart();
}

View on GitHub (pinned to bdb3acd5dd)

Solutions

  1. Validate ChartType with Enum.IsDefined before constructing the chart.
  2. Default unknown persisted ChartType values to ChartType.Bar on load.
  3. Ensure consistent MudBlazor versions across all referenced projects.

Example fix

// before
var type = (ChartType)configInt;

// after
var type = Enum.IsDefined(typeof(ChartType), configInt)
    ? (ChartType)configInt
    : ChartType.Bar;
Defensive patterns

Strategy: validation

Validate before calling

var type = Enum.IsDefined(typeof(ChartType), raw) ? (ChartType)raw : ChartType.Bar;

Type guard

static bool IsValidChartType(ChartType t) => Enum.IsDefined(typeof(ChartType), t);

Prevention

When it happens

Trigger: ChartType set to an undefined numeric value; a new ChartType member added without an options mapping; version skew between the enum and the resolver.

Common situations: Loading chart config with a stale ChartType integer from an older or newer schema; reflection-based assignment of ChartType; partial library upgrade.

Related errors


AI-assisted analysis of MudBlazor/MudBlazor@bdb3acd5dd (2026-08-13). Data as JSON: /api/errors/d1871ac248de2329. Report an issue: GitHub.