dotnet/wpf · error · NotImplementedException

The method or operation is not implemented.

Error message

The method or operation is not implemented.

What it means

This is the same unimplemented ImageSourceTypeConverter.ConvertFrom body: it validates null and supported type first, then always throws NotImplementedException. The library intentionally provides no from-conversion for image sources in XPS serialization; only ConvertTo is functional.

Solutions

  1. Use BitmapImage/BitmapFrame constructors instead of this converter's ConvertFrom.
  2. Override or replace the converter if from-conversion is genuinely required.
  3. Guard calls with a capability check or catch NotImplementedException.

Example fix

// before
object result = converter.ConvertFrom(context, culture, stream);

// after
BitmapSource result = BitmapFrame.Create(stream);
result.Freeze();
Defensive patterns

Strategy: fallback

Try / catch

try
{
    source = (BitmapSource)converter.ConvertFrom(context, culture, stream);
}
catch (NotImplementedException)
{
    stream.Position = 0;
    source = BitmapFrame.Create(stream);
}

Prevention

When it happens

Trigger: Any invocation of ConvertFrom with a non-null value whose type passes IsSupportedType — the throw is unconditional after validation.

Common situations: Generic TypeConverter-based data binding or XAML loading of image source properties; unit tests exercising the full converter API surface.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/ImageSourceTypeConverter.cs:115

        /// 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)