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
- Use BitmapImage/BitmapFrame constructors instead of this converter's ConvertFrom.
- Override or replace the converter if from-conversion is genuinely required.
- 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
- Treat ConvertFrom on ImageSourceTypeConverter as permanently unsupported.
- Use BitmapFrame.Create overloads (Uri, stream) for all image construction.
- Add a unit test that exercises your conversion path so NotImplementedException surfaces early.
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
- Cannot convert from type.
- Cannot convert to type.
- The method or operation is not implemented.
- 'value' must be of type 'BitmapSource'.
- " }} " element found. Expected fixed page element ( }} ).
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)