{"record":{"id":"653c933e11ec2cf9","repo":"dotnet/machinelearning","slug":"string-format-microsoft-data-strings-vectorsubtype","errorCode":null,"errorMessage":"String.Format(Microsoft.Data.Strings.VectorSubTypeNotSupported, itemType.ToString())","messagePattern":"String\\.Format\\(Microsoft\\.Data\\.Strings\\.VectorSubTypeNotSupported, itemType\\.ToString\\(\\)\\)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/IDataView.Extension.cs","lineNumber":212,"sourceCode":"            }\n            else if (itemType.RawType == typeof(ushort))\n            {\n                return new VBufferDataFrameColumn<ushort>(name);\n            }\n            else if (itemType.RawType == typeof(char))\n            {\n                return new VBufferDataFrameColumn<char>(name);\n            }\n            else if (itemType.RawType == typeof(decimal))\n            {\n                return new VBufferDataFrameColumn<decimal>(name);\n            }\n            else if (itemType.RawType == typeof(ReadOnlyMemory<char>))\n            {\n                return new VBufferDataFrameColumn<ReadOnlyMemory<char>>(name);\n            }\n\n            throw new NotSupportedException(String.Format(Microsoft.Data.Strings.VectorSubTypeNotSupported, itemType.ToString()));\n        }\n    }\n\n}\n","sourceCodeStart":194,"sourceCodeEnd":217,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/IDataView.Extension.cs#L194-L217","documentation":"GetVectorDataFrame allocates a VBufferDataFrameColumn<T> only for a fixed set of vector item types; for any other itemType it throws NotSupportedException(Strings.VectorSubTypeNotSupported, itemType). Reached from ToDataFrame when a vector column's element type is unsupported.","triggerScenarios":"Converting an IDataView whose schema has a VectorDataViewType with an item type outside the supported list (e.g. vectors of TimeSpan or unknown structs).","commonSituations":"Custom IDataView implementations exposing vector columns of unusual element types; transforms producing vectors of non-standard primitives; exotic data sources fed to ToDataFrame.","solutions":["Change the pipeline so the vector item type is a supported primitive (e.g. float, double, ReadOnlyMemory<char>).","Project the unsupported vector into a supported representation in the source IDataView.","Remove or split the unsupported vector column before calling ToDataFrame.","Copy the column manually into a VBufferDataFrameColumn<T> of a supported T."],"exampleFix":"// before\nvar df = dataView.ToDataFrame(); // vector of unsupported item type\n// after\n// expose the column as a vector of float in the source:\nOutput = new VectorDataViewType(NumberDataViewType.Single, size);","handlingStrategy":"validation","validationCode":"bool ok = dataView.Schema.Where(s => s.Type is VectorDataViewType v)\n    .All(s => IsSupportedItemType(((VectorDataViewType)s.Type).ItemType));","typeGuard":"static bool IsSupportedItemType(DataViewType t) =>\n    t == NumberDataViewType.Single || t == NumberDataViewType.Double ||\n    t == TextDataViewType.Instance || t == NumberDataViewType.Int32;","tryCatchPattern":"try { var df = dataView.ToDataFrame(); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"vector\"))\n{ /* unsupported vector item type: reproject the column */ }","preventionTips":["Restrict vector columns to supported item types at the source.","Assert vector item types in pipeline unit tests.","Convert exotic vectors to float/double upstream.","Document supported item types for custom IDataView implementations."],"tags":["not-supported-exception","idataview","vector","item-type"],"backgroundTag":"unsupported-operation","analyzedSha":"7b76e69cf964daeca3f1377af6bc5543284d56c6","analyzedAt":"2026-09-11T12:35:38.930Z","contentChangedAt":"2026-09-11T12:35:38.930Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}