Description
When using a component property of type byte, its value cannot be assigned using source generated XAML. Instead, BindableObject logs a warning.
The same property works fine with XAMLC or runtime inflation.
Steps to Reproduce
- Create a component with a
byte property:
public static readonly BindableProperty MyByteProperty = BindableProperty.Create(
nameof(MyByte),
typeof(byte),
typeof(MyComponent),
(byte)255);
public byte MyByte
{
get => (byte)this.GetValue(MyByteProperty);
set => this.SetValue(MyByteProperty, value);
}
- Use the component parameter in XAML:
<MyComponent MyByte="150"/>
- Enable source generated XAML:
<MauiXamlInflator>SourceGen</MauiXamlInflator>
- Initialize the outer component.
Expected: The property should have the configured value (150 in the example).
Actual: The property always has the default value (255 in the example).
Link to public reproduction project repository
No response
Version with bug
10.0.50
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.120 SR12
Affected platforms
Android, iOS
Affected platform versions
Any
Did you find any workaround?
Specify the data type explicitly:
<MyComponent.MyByte>
<x:Byte>150</x:Byte>
</MyComponent.MyByte>
Relevant log output
Cannot convert 150 to type 'System.Byte'
Description
When using a component property of type
byte, its value cannot be assigned using source generated XAML. Instead,BindableObjectlogs a warning.The same property works fine with XAMLC or runtime inflation.
Steps to Reproduce
byteproperty:<MyComponent MyByte="150"/><MauiXamlInflator>SourceGen</MauiXamlInflator>Expected: The property should have the configured value (150 in the example).
Actual: The property always has the default value (255 in the example).
Link to public reproduction project repository
No response
Version with bug
10.0.50
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.120 SR12
Affected platforms
Android, iOS
Affected platform versions
Any
Did you find any workaround?
Specify the data type explicitly:
Relevant log output