{"record":{"id":"89f3043cfcd470c4","repo":"dotnet/machinelearning","slug":"column","errorCode":null,"errorMessage":"column","messagePattern":"column","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.ML.DataView/DataViewSchema.cs","lineNumber":224,"sourceCode":"                }\n                Schema = schema;\n                _getters = getters;\n            }\n\n            private void CheckGetter<TValue>(Delegate getter)\n            {\n                var typedGetter = getter as ValueGetter<TValue>;\n                if (typedGetter == null)\n                    throw new ArgumentNullException(nameof(getter), $\"Getter of type '{typeof(TValue)}' expected, but {getter.GetType()} found\");\n            }\n\n            /// <summary>\n            /// Get a getter delegate for one value of the annotations row.\n            /// </summary>\n            public ValueGetter<TValue> GetGetter<TValue>(DataViewSchema.Column column)\n            {\n                if (column.Index >= _getters.Length)\n                    throw new ArgumentException(nameof(column));\n                var typedGetter = _getters[column.Index] as ValueGetter<TValue>;\n                if (typedGetter == null)\n                {\n                    Debug.Assert(_getters[column.Index] != null);\n                    throw new InvalidOperationException($\"Invalid call to '{nameof(GetGetter)}'\");\n                }\n                return typedGetter;\n            }\n\n            /// <summary>\n            /// Get the value of an annotation, by annotation kind (aka column name).\n            /// </summary>\n            public void GetValue<TValue>(string kind, ref TValue value)\n            {\n                var column = Schema.GetColumnOrNull(kind);\n                if (column == null)\n                    throw new InvalidOperationException($\"Invalid call to '{nameof(GetValue)}'\");\n                GetGetter<TValue>(column.Value)(ref value);","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.ML.DataView/DataViewSchema.cs#L206-L242","documentation":"Annotations.GetGetter<TValue> throws ArgumentException naming 'column' when the requested column's Index is outside the annotations' internal getter array (column.Index >= _getters.Length). It means the column does not belong to this annotations schema or the wrong Annotations object was queried.","triggerScenarios":"Calling annotations.GetGetter<TValue>(column) with a column from a different schema whose Index exceeds the annotation getter count, or with an annotation column index computed against a larger schema.","commonSituations":"Requesting metadata (e.g. slot names) for a column in schema A using the Annotations object of column in schema B after a transform changed columns; iterating all schema columns and querying annotations for each without checking membership.","solutions":["Only pass columns that belong to the annotations' own schema; verify column.Schema identity/annotation membership before calling.","Guard with column.Index < annotations.Schema.Count (or an equivalent bounds check) before requesting the getter.","Get the Annotations from the correct column: annotations for column C are typically reached via C.Annotations.","If copying between schemas, remap indices to the target schema instead of reusing the source column."],"exampleFix":"// before\nvar getter = sourceCol.Annotations.GetGetter<VBuffer<float>>(someOtherSchemaColumn); // Index out of range\n// after\nif (someOtherSchemaColumn.Index < sourceCol.Annotations.Schema.Count)\n{\n    var getter = sourceCol.Annotations.GetGetter<VBuffer<float>>(sourceCol.Annotations.Schema[someOtherSchemaColumn.Index]);\n}\nelse { /* column has no such annotation */ }","handlingStrategy":"validation","validationCode":"bool canGet = column.Index < annotations.Schema.Count;","typeGuard":"bool AnnotationExists(DataViewSchema.Column col, int annotationIndex) => annotationIndex < col.Annotations.Schema.Count;","tryCatchPattern":"try { var g = col.Annotations.GetGetter<TValue>(annCol); } catch (ArgumentException) { /* annotation not present for this column */ }","preventionTips":["Query Annotations only with columns belonging to the same schema","Check annotation schema membership before requesting getters"],"tags":["dotnet","argument-exception","annotations","schema"],"backgroundTag":"invalid-argument-value","analyzedSha":"7b76e69cf964daeca3f1377af6bc5543284d56c6","analyzedAt":"2026-09-11T12:35:38.930Z","contentChangedAt":"2026-09-11T12:35:38.930Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}