dotnet/wpf · error · NotImplementedException

The method or operation is not implemented.

Error message

The method or operation is not implemented.

What it means

ColorTypeConverter.ConvertFrom throws NotImplementedException for any supported input type: its body intentionally ends with 'throw new NotImplementedException()'. Conversion 'from' via this converter is simply not implemented in ReachFramework.

Solutions

  1. Do not use ColorTypeConverter.ConvertFrom; use ColorConverter.ConvertFromString/ConvertFromInvariantString.
  2. Construct Color directly via Color.FromRgb/Color.FromArgb.
  3. Guard calls with a try/catch for NotImplementedException if the converter is invoked indirectly.
  4. Register a custom TypeConverter implementing conversion if you need this path.

Example fix

// before
var c = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFrom(null, null, "Red");
// after
var c = Color.FromRgb(0xFF, 0x00, 0x00);
Defensive patterns

Strategy: try-catch

Try / catch

try { return converter.ConvertFrom(context, culture, value); }
catch (NotImplementedException) { return ColorConverter.ConvertFromString(value?.ToString()); }

Prevention

When it happens

Trigger: Calling ConvertFrom (e.g. ConvertFromString) on ColorTypeConverter with a value of a type that passes IsSupportedType - the method always throws.

Common situations: XAML designer or serialization frameworks invoking the converter; developers assuming the standard TypeConverter contract is honored.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/de548ffdffa6c00c. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/ColorTypeConverter.cs:111

        /// <returns>
        /// An Object that represents the converted value.
        /// </returns>
        public
        override
        object
        ConvertFrom(
            ITypeDescriptorContext              context,
            System.Globalization.CultureInfo    culture,
            object                              value
            )
        {
            ArgumentNullException.ThrowIfNull(value);
            if (!IsSupportedType(value.GetType()))
            {
                throw new NotSupportedException(SR.Converter_ConvertFromNotSupported);
            }

            throw new NotImplementedException();
        }

        /// <summary>
        /// Converts the given value object to the specified type,
        /// using the arguments.
        /// </summary>
        /// <param name="context">
        /// An ITypeDescriptorContext that provides a format context.
        /// </param>
        /// <param name="culture">
        /// A CultureInfo object. If null is passed, the current
        /// culture is assumed.
        /// </param>
        /// <param name="value">
        /// The Object to convert.
        /// </param>
        /// <param name="destinationType">
        /// The Type to convert the value parameter to.

View on GitHub (pinned to 81131a70a4)