dotnet/wpf · error
SR.Format(SR.ParserCannotConvertPropertyValue, "Value"…
Error message
SR.Format(SR.ParserCannotConvertPropertyValue, "Value", typeof(Object).FullName)
What it means
SetterTriggerConditionValueConverter.ResolveValue needs IXamlSchemaContextProvider from the service provider to convert the 'Value' string of a Setter/Trigger/Condition. If the schema context service is absent, the converter cannot operate, so it throws NotSupportedException indicating it cannot convert the Value property to Object.
Solutions
- Ensure conversion happens within the standard WPF XAML load pipeline which supplies IXamlSchemaContextProvider
- If calling manually, provide an IServiceProvider that implements GetService(typeof(IXamlSchemaContextProvider))
- Use a different conversion mechanism (e.g. TypeDescriptor.GetConverter) when not under XAML parse
Example fix
// before var converter = new SetterTriggerConditionValueConverter(); var value = converter.ConvertFromString(null); // no schema context service // after // let the XAML parser perform the conversion, or supply a proper service provider var value = (string)xamlSchemaContextClrValue; // convert via schema context when hand-rolling
Defensive patterns
Strategy: try-catch
Validate before calling
var sc = serviceProvider.GetService(typeof(IXamlSchemaContextProvider)) as IXamlSchemaContextProvider;
if (sc == null) throw new InvalidOperationException("Setter/Trigger conversion requires a XAML schema context"); Type guard
bool HasSchemaContext(IServiceProvider sp) => sp?.GetService(typeof(IXamlSchemaContextProvider)) is IXamlSchemaContextProvider;
Try / catch
try { value = converter.ConvertFromString(serviceProvider, valueString); }
catch (NotSupportedException ex) { /* conversion attempted outside XAML parse; use parser or proper service provider */ } Prevention
- Let the WPF XAML parser perform Setter/Trigger Value conversions
- Do not call SetterTriggerConditionValueConverter directly with minimal service providers
- Provide IXamlSchemaContextProvider when hand-rolling XAML tooling
When it happens
Trigger: Using SetterTriggerConditionValueConverter (the Value of Setter/Trigger/Condition properties) outside of a proper XAML schema context, e.g. calling TypeConverter.ConvertFromString with a bare or incomplete ITypeDescriptorContext/IServiceProvider that doesn't supply IXamlSchemaContextProvider.
Common situations: Invoking the converter directly at runtime without going through the XAML parser; custom tooling that fakes the service provider; parsing Styles with a non-WPF XAML reader lacking schema-context services.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- NotSupportedException
- SR.Format(SR.DeferringLoaderNoSave…
- SR.MultiBindingHasNoConverter
- SR.ParserProvideValueCantSetUri
- SR.Unsupported_MouseAction (mouseActionToken)
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/6dffa12c1020ee18.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/SetterTriggerConditionValueConverter.cs:97
#endregion Public Methods
internal static object ResolveValue(ITypeDescriptorContext serviceProvider,
DependencyProperty property, CultureInfo culture, object source)
{
ArgumentNullException.ThrowIfNull(serviceProvider);
ArgumentNullException.ThrowIfNull(source);
// Only need to type convert strings and byte[]
if (!(source is byte[] || source is String || source is Stream))
{
return source;
}
IXamlSchemaContextProvider ixsc = (serviceProvider.GetService(typeof(IXamlSchemaContextProvider))
as IXamlSchemaContextProvider);
if (ixsc == null)
{
throw new NotSupportedException(SR.Format(SR.ParserCannotConvertPropertyValue, "Value", typeof(Object).FullName));
}
XamlSchemaContext schemaContext = ixsc.SchemaContext;
if (property != null)
{
//Get XamlMember from dp
System.Xaml.XamlMember xamlProperty =
schemaContext.GetXamlType(property.OwnerType).GetMember(property.Name);
if (xamlProperty == null)
xamlProperty =
schemaContext.GetXamlType(property.OwnerType).GetAttachableMember(property.Name);
System.Xaml.Schema.XamlValueConverter<TypeConverter> typeConverter = null;
if (xamlProperty != null)
{
// If we have a Baml2006SchemaContext and the property is of type Enum, we already know that the
// type converter must be the EnumConverter.View on GitHub (pinned to 81131a70a4)