dotnet/machinelearning · error · NotImplementedException
The method or operation is not implemented.
Error message
The method or operation is not implemented.
What it means
The base DataFrameColumn.Add(DataFrameColumn, bool) virtual has no implementation in the abstract base class; it exists so derived primitive columns can override it. Calling it on a base-typed column that lacks an override throws NotImplementedException.
Source
Thrown at src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs:20
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// Generated from DataFrameColumn.BinaryOperations.tt. Do not modify directly
using System;
using System.Collections.Generic;
namespace Microsoft.Data.Analysis
{
public abstract partial class DataFrameColumn
{
/// <summary>
/// Performs element-wise addition
/// </summary>
public virtual DataFrameColumn Add(DataFrameColumn column, bool inPlace = false)
{
throw new NotImplementedException();
}
/// <summary>
/// Performs an element-wise addition on each value in the column
/// </summary>
public virtual DataFrameColumn Add<T>(T value, bool inPlace = false)
{
throw new NotImplementedException();
}
/// <summary>
/// Performs a reversed element-wise addition on each value in the column
/// </summary>
public virtual DataFrameColumn ReverseAdd<T>(T value, bool inPlace = false)
{
throw new NotImplementedException();
}
View on GitHub (pinned to 7b76e69cf9)
Solutions
- Cast columns to their concrete primitive types (e.g. PrimitiveDataFrameColumn<int>) which override Add
- Use the DataFrame-level arithmetic API that dispatches on column kinds
- In custom column subclasses, implement the Add override
Example fix
// before DataFrameColumn result = colA.Add(colB); // after var result = ((PrimitiveDataFrameColumn<int>)colA).Add((PrimitiveDataFrameColumn<int>)colB);
Defensive patterns
Strategy: type-guard
Validate before calling
if (column is not PrimitiveDataFrameColumn<int>) throw new NotSupportedException("Add is only supported on primitive columns."); Type guard
bool SupportsBinaryOp(DataFrameColumn c) => c is PrimitiveDataFrameColumn<sbyte> or PrimitiveDataFrameColumn<int> or PrimitiveDataFrameColumn<long> or PrimitiveDataFrameColumn<float> or PrimitiveDataFrameColumn<double>;
Try / catch
try { result = colA.Add(colB); }
catch (NotImplementedException) { /* fall back to concrete-type dispatch or manual loop */ } Prevention
- Check the concrete column type before polymorphic arithmetic
- Keep DataFrame column operations within implemented primitive types
- In custom columns, always override the binary-operation virtuals
When it happens
Trigger: Invoking columnA.Add(columnB) where the runtime column type does not override Add, e.g. performing element-wise addition on unsupported column types (strings mixed with primitives) through a DataFrameColumn reference.
Common situations: Polymorphic column math on heterogeneous frames; custom column subclasses that forgot to override Add; older runtime versions lacking overrides for a specific primitive type.
Related errors
- NotImplementedException
- {fieldType.Name}
- MismatchedColumnLengths
- Parameter must not be null, empty, or whitespace
- Value cannot be null. (Parameter 'idColumns')
AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11).
Data as JSON: /api/errors/5a7eef7846ab8558.
Report an issue: GitHub.