-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Binding with Converter and x:DataType is not compiled — falls back to runtime and throws missing resource #34713
Description
Description
When a Binding has both a Converter={StaticResource ...} and is inside a scope with x:DataType, the binding is not compiled (i.e., no TypedBinding is generated). Instead, it falls back to a runtime-interpreted binding.
At runtime, the interpreted binding tries to resolve the StaticResource converter through the standard resource lookup path, which can fail — resulting in a missing resource exception.
Expected Behavior
The binding should be compiled into a TypedBinding (just like bindings without converters), with the converter resolved at runtime via this.Resources["key"].
Actual Behavior
The binding falls back to runtime interpretation and throws:
Resource not found: "SomeConverter"
Steps to Reproduce
- Create a page with
x:DataTypeset on a parent element - Add a
LabelwithText="{Binding SomeProperty, Converter={StaticResource SomeConverter}}" - Ensure
SomeConverteris not present in the page Resources - Build and run — the app crashes
Context
This is a BindingSourceGen limitation — the source generator likely skips bindings with converters because it cannot statically resolve the converter type from a StaticResource reference.
Affected Area
- BindingSourceGen (compiled bindings with converters)