Skip to content

Commit 9642d84

Browse files
Copilotjonpryor
andcommitted
docs: Add documentation for automatic binding preservation in Native AOT
Co-authored-by: jonpryor <155958+jonpryor@users.noreply.github.com>
1 parent 24504ec commit 9642d84

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/articles/features/using-skia-desktop.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,26 @@ To build an app with this feature enabled:
133133
> [!NOTE]
134134
> .NET Native AOT on Windows is not yet supported as WPF does not support it at this time.
135135
136+
### Automatic Binding Preservation
137+
138+
When building with Native AOT, Uno Platform automatically preserves public properties of types referenced by `[Bindable]` types to ensure data binding works correctly at runtime. This happens automatically when `PublishAot=true` is set.
139+
140+
The build system:
141+
1. Finds all types marked with `Microsoft.UI.Xaml.Data.BindableAttribute` or `Uno.Extensions.Reactive.Bindings.BindableAttribute`
142+
2. Discovers types referenced by public properties of those bindable types
143+
3. Generates an ILLink descriptor file to preserve the public properties (getters/setters) of discovered types
144+
145+
For example, if you have:
146+
```csharp
147+
[Bindable]
148+
public class MainViewModel
149+
{
150+
public Entity MyEntity { get; set; }
151+
}
152+
153+
public record Entity(string Name);
154+
```
155+
156+
The build system will automatically preserve the `Name` property of `Entity`, allowing `{Binding MyEntity.Name}` expressions to work correctly in Native AOT builds.
157+
136158
For more information, see [the runtime documentation](https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/reflection-in-aot-mode.md) and the [.NET Native AOT documentation](https://learn.microsoft.com/dotnet/core/deploying/native-aot/).

0 commit comments

Comments
 (0)