dotnet/wpf · error · NotSupportedException
Cannot convert from type.
Error message
Cannot convert from type.
What it means
ImageSourceTypeConverter.ConvertFrom is not implemented: after validating that the value is a supported source type, it throws NotImplementedException. Converting any object (e.g. a string URI or stream) into a BitmapSource via this converter is unsupported by design — use BitmapFrame/Create APIs instead.
Solutions
- Do not use ImageSourceTypeConverter for value creation; construct the image with BitmapFrame.Create(uri) or new BitmapImage(new Uri(path)).
- If invoked indirectly by a framework, register a different TypeConverter that implements ConvertFrom.
- Catch NotImplementedException and perform the conversion manually via BitmapFrame.Create.
Example fix
// before var source = (BitmapSource)converter.ConvertFrom(context, culture, imagePath); // after var source = (BitmapSource)BitmapFrame.Create(new Uri(imagePath));
Defensive patterns
Strategy: fallback
Try / catch
try
{
source = (BitmapSource)converter.ConvertFrom(context, culture, value);
}
catch (NotImplementedException)
{
source = BitmapFrame.Create((Uri)value); // manual construction
} Prevention
- Build image sources with BitmapImage/BitmapFrame constructors, not ImageSourceTypeConverter.ConvertFrom.
- Remember this converter only supports ConvertTo within XPS serialization.
- Route XAML image parsing through the standard WPF image-source converter instead.
When it happens
Trigger: Calling ImageSourceTypeConverter.ConvertFrom(context, culture, value) with any supported type value; TypeConverter.ConvertFromString / ConvertFrom invoked by parsers or designers on an image-source property handled by this converter.
Common situations: XAML or designer pipelines attempting to convert an image path string via this converter; developers using TypeDescriptor to build BitmapSource values during XPS serialization setup.
Related errors
- The method or operation is not implemented.
- 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/85507071683a6b69.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/ImageSourceTypeConverter.cs:112
/// The Object to convert.
/// </param>
/// <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.View on GitHub (pinned to 81131a70a4)