dotnet/machinelearning · error · NotSupportedException

String.Format(Microsoft.Data.Strings.NotSupportedColumnType,

Error message

String.Format(Microsoft.Data.Strings.NotSupportedColumnType, type.RawType.Name)

What it means

ToDataFrame can only map column kinds it knows (supported primitives and vector types); when a column's DataViewType is neither, it throws NotSupportedException(Strings.NotSupportedColumnType, type.RawType.Name). The DataFrame column model has no representation for that type.

Source

Thrown at src/Microsoft.Data.Analysis/IDataView.Extension.cs:125

                else if (type == NumberDataViewType.UInt64)
                {
                    dataFrameColumns.Add(new UInt64DataFrameColumn(dataViewColumn.Name));
                }
                else if (type == NumberDataViewType.UInt16)
                {
                    dataFrameColumns.Add(new UInt16DataFrameColumn(dataViewColumn.Name));
                }
                else if (type == TextDataViewType.Instance)
                {
                    dataFrameColumns.Add(new StringDataFrameColumn(dataViewColumn.Name));
                }
                else if (type is VectorDataViewType vectorType)
                {
                    dataFrameColumns.Add(GetVectorDataFrame(vectorType, dataViewColumn.Name));
                }
                else
                {
                    throw new NotSupportedException(String.Format(Microsoft.Data.Strings.NotSupportedColumnType, type.RawType.Name));
                }
            }

            using (DataViewRowCursor cursor = dataView.GetRowCursor(activeDataViewColumns))
            {
                Delegate[] activeColumnDelegates = new Delegate[activeDataViewColumns.Count];
                int columnIndex = 0;
                foreach (DataViewSchema.Column activeDataViewColumn in activeDataViewColumns)
                {
                    Delegate valueGetter = dataFrameColumns[columnIndex].GetValueGetterUsingCursor(cursor, activeDataViewColumn);
                    activeColumnDelegates[columnIndex] = valueGetter;
                    columnIndex++;
                }
                while (cursor.MoveNext() && cursor.Position < maxRows)
                {
                    for (int i = 0; i < activeColumnDelegates.Length; i++)
                    {
                        dataFrameColumns[i].AddValueUsingCursor(cursor, activeColumnDelegates[i]);

View on GitHub (pinned to 7b76e69cf9)

Solutions

  1. Drop unsupported columns before conversion via ColumnSelectingTransformer.
  2. Convert key-typed columns to primitives with KeyToValueMapping/KeyToVectorMapping first.
  3. Inspect dataView.Schema up front and skip columns whose Type is unsupported.
  4. Copy unsupported columns manually into primitive/VBuffer columns yourself.

Example fix

// before
var df = pipelineOutput.ToDataFrame(); // schema has key-typed column
// after
var select = new ColumnSelectingTransformer(env, keepColumns: supportedColumnNames);
var df = select.Transform(pipelineOutput).ToDataFrame();
Defensive patterns

Strategy: validation

Validate before calling

bool convertible = dataView.Schema.All(s =>
    s.Type is VectorDataViewType || s.Type is PrimitiveDataViewType);
if (!convertible) throw new InvalidOperationException("Schema has unsupported column types; filter them first");

Type guard

bool isConvertibleColumn(DataViewSchema.Column c) => c.Type is VectorDataViewType || c.Type is PrimitiveDataViewType;

Try / catch

try { var df = dataView.ToDataFrame(); }
catch (NotSupportedException ex) when (ex.Message.Contains("column"))
{ /* unsupported column type: select/drop columns and retry */ }

Prevention

When it happens

Trigger: Calling dataView.ToDataFrame() on a schema containing a column whose type is not a supported scalar primitive nor a handled VectorDataViewType — e.g. key-type columns or blittable struct columns.

Common situations: Pipelines emitting key-typed or custom-mapped columns; converting ML.NET transform outputs beyond the extension's supported set; schema drift after changing a pipeline stage.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11). Data as JSON: /api/errors/31e495cc2e95e771. Report an issue: GitHub.