You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The x:Bind code generation process fails to recognize properties on dynamic type.
Steps to reproduce the bug
Create a class type called PageTag derived from DynamicObject and implementing ICustomPropertyProvider. Create a Page-derived class called PageBase with a DependencyProperty that holds a PageTag and accessed through dynamic type:
public dynamic? PageTag {
get { return (PageTag?)this.GetValue(PageTagProperty); }
set { this.SetValue(PageTagProperty, value); }
}
public static DependencyProperty PageTagProperty { get; } = DependencyProperty.Register(nameof(PageBase.PageTag), typeof(PageTag), typeof(PageBase), new PropertyMetadata(default(PageTag)));
Assign an instance of PageTag to the PageTag property, such that the instance object has a dynamically defined string property called 'Name'. Now try binding to PageTag.Name using Binding and x:Bind, e.g.:
The use of Binding works (assuming that DataContext is set correctly). The x:Bind fails at compile time with the message "XamlCompiler error WMC1110: Invalid binding path 'PageTag.Name' : Property 'Name' not found on type 'Object'."
Expected behavior
The message shows that x:Bind is mistakenly replacing 'dynamic' with 'object'. The x:Bind should use the dynamic type in this case, not Object type. It should compile and run.
Screenshots
No response
NuGet package version
None
Windows version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
The x:Bind code generation process fails to recognize properties on dynamic type.
Steps to reproduce the bug
Create a class type called PageTag derived from DynamicObject and implementing ICustomPropertyProvider. Create a Page-derived class called PageBase with a DependencyProperty that holds a PageTag and accessed through dynamic type:
Assign an instance of PageTag to the PageTag property, such that the instance object has a dynamically defined string property called 'Name'. Now try binding to PageTag.Name using Binding and x:Bind, e.g.:
The use of Binding works (assuming that DataContext is set correctly). The x:Bind fails at compile time with the message "XamlCompiler error WMC1110: Invalid binding path 'PageTag.Name' : Property 'Name' not found on type 'Object'."
Expected behavior
The message shows that x:Bind is mistakenly replacing 'dynamic' with 'object'. The x:Bind should use the dynamic type in this case, not Object type. It should compile and run.
Screenshots
No response
NuGet package version
None
Windows version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: