{"record":{"id":"2bb41df161592248","repo":"dotnet/machinelearning","slug":"kind","errorCode":null,"errorMessage":"kind","messagePattern":"kind","errorType":"exception","errorClass":"System.NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/DataFrame.IO.cs","lineNumber":345,"sourceCode":"            else if (kind == typeof(uint))\n            {\n                ret = new UInt32DataFrameColumn(columnName);\n            }\n            else if (kind == typeof(ulong))\n            {\n                ret = new UInt64DataFrameColumn(columnName);\n            }\n            else if (kind == typeof(ushort))\n            {\n                ret = new UInt16DataFrameColumn(columnName);\n            }\n            else if (kind == typeof(DateTime))\n            {\n                ret = new DateTimeDataFrameColumn(columnName);\n            }\n            else\n            {\n                throw new NotSupportedException(nameof(kind));\n            }\n            return ret;\n        }\n\n        private static DataFrameColumn CreateColumn(Type kind, string[] columnNames, int columnIndex)\n        {\n            return CreateColumn(kind, GetColumnName(columnNames, columnIndex));\n        }\n\n        private static DataFrame ReadCsvLinesIntoDataFrame(WrappedStreamReaderOrStringReader wrappedReader,\n                                char separator = ',', bool header = true,\n                                string[] columnNames = null, Type[] dataTypes = null,\n                                long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false,\n                                bool renameDuplicatedColumns = false,\n                                CultureInfo cultureInfo = null, Func<IEnumerable<string>, Type> guessTypeFunction = null)\n        {\n            if (cultureInfo == null)\n            {","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/DataFrame.IO.cs#L327-L363","documentation":"CreateColumn maps a column Type (the 'kind') to a concrete DataFrameColumn implementation. If the kind is not one of the supported primitive types, string, or DateTime, it throws NotSupportedException(nameof(kind)), so the runtime message is literally \"kind\". It means CSV type inference/dataTypes requested a column type the library cannot construct.","triggerScenarios":"Passing a dataTypes entry (or a custom guessTypeFunction result) that is not a supported column type — e.g. typeof(Guid), typeof(short) if unsupported in this version, nullable variants, or any arbitrary Type — into LoadCsv/LoadCsvFromString, which reaches CreateColumn via column/CreateColumn.","commonSituations":"Users supply dataTypes: new[]{typeof(object)} or business types; a custom guessTypeFunction returns an unsupported Type; a type supported in newer Microsoft.Data.Analysis versions is used against an older package.","solutions":["Use only supported column types: primitives (bool, byte, char, decimal, double, float, int, long, sbyte, short, uint, ulong, ushort), string, and DateTime","Fix the dataTypes array entries passed to LoadCsv to supported types","Fix the custom guessTypeFunction so it returns only supported types","Upgrade the Microsoft.Data.Analysis package if you need a type added in a newer version"],"exampleFix":"// before\nvar df = DataFrame.LoadCsv(stream, dataTypes: new[] { typeof(Guid) });\n// after\nvar df = DataFrame.LoadCsv(stream, dataTypes: new[] { typeof(string) }); // then convert as needed","handlingStrategy":"type-guard","validationCode":"static readonly HashSet<Type> Supported = new HashSet<Type> { typeof(bool), typeof(byte), typeof(char), typeof(decimal), typeof(double), typeof(float), typeof(int), typeof(long), typeof(sbyte), typeof(short), typeof(uint), typeof(ulong), typeof(ushort), typeof(string), typeof(DateTime) };\nbool ok = dataTypes == null || dataTypes.All(Supported.Contains);","typeGuard":"bool IsSupportedColumnType(Type t) => t == typeof(string) || t == typeof(DateTime) || (t.IsPrimitive && t != typeof(IntPtr) && t != typeof(UIntPtr));","tryCatchPattern":"try { return DataFrame.LoadCsv(stream, dataTypes: dataTypes); } catch (NotSupportedException) { return DataFrame.LoadCsv(stream, dataTypes: dataTypes.Select(t => typeof(string)).ToArray()); }","preventionTips":["Only emit supported types from custom guessTypeFunction","Centralize the allowed-type whitelist","Check package release notes before using newer column types"],"tags":["notsupported","dataframe","csv"],"backgroundTag":"unsupported-operation","analyzedSha":"7b76e69cf964daeca3f1377af6bc5543284d56c6","analyzedAt":"2026-09-11T12:35:38.930Z","contentChangedAt":"2026-09-11T12:35:38.930Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}