diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs index 82eb829238fb..e7729393205e 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs @@ -364,7 +364,7 @@ where field.IsStatic if ( property.SetMethod != null - && property.SetMethod != null + && !property.SetMethod.IsInitOnly && property.SetMethod.IsLocallyPublic(_currentModule!) ) { diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Data/BindableNullableValueTypeTestPage.xaml.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Data/BindableNullableValueTypeTestPage.xaml.cs index 60bc58fdc2bb..3dd38d68be88 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Data/BindableNullableValueTypeTestPage.xaml.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Data/BindableNullableValueTypeTestPage.xaml.cs @@ -30,4 +30,8 @@ public int? MyProperty } } } + +#if !WINAPPSDK // https://github.com/microsoft/microsoft-ui-xaml/issues/5315 + public int MyInitOnlyProperty { get; init; } +#endif }