Skip to content

Commit 12d31b5

Browse files
Copilotjeromelaban
andcommitted
feat: Add BindableAttribute to Uno.Foundation types for NAOT trimmer
Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
1 parent 11ff070 commit 12d31b5

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

src/SourceGenerators/Uno.UI.SourceGenerators/Uno.UI.SourceGenerators.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26+
<Compile Include="..\..\Uno.Foundation\Internals\BindableAttribute.cs">
27+
<Link>XamlGenerator\XamlPathParser\BindableAttribute.cs</Link>
28+
</Compile>
2629
<Compile Include="..\..\Uno.Foundation\Point.cs">
2730
<Link>XamlGenerator\XamlPathParser\Point.cs</Link>
2831
</Compile>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#nullable enable
2+
3+
using System;
4+
5+
namespace Uno.Foundation.Internals
6+
{
7+
/// <summary>
8+
/// Marks a type as bindable for the NAOT trimmer.
9+
/// This attribute is used by the BindableTypeProvidersSourceGenerator to identify types
10+
/// that should have binding metadata generated, preventing them from being trimmed.
11+
/// </summary>
12+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
13+
internal sealed class BindableAttribute : Attribute
14+
{
15+
public BindableAttribute()
16+
{
17+
}
18+
}
19+
}

src/Uno.Foundation/Point.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
namespace Windows.Foundation;
1212

1313
[DebuggerDisplay("{DebugDisplay,nq}")]
14+
[Uno.Foundation.Internals.Bindable]
1415
public partial struct Point
1516
{
1617
// These are public in WinUI (with the underscore!), but we don't want to expose it for now at least.

src/Uno.Foundation/Rect.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Windows.Foundation;
1010

1111
[DebuggerDisplay("[Rect {Size}@{Location}]")]
12+
[Uno.Foundation.Internals.Bindable]
1213
public partial struct Rect
1314
{
1415
// These are public in WinUI (with the underscore!), but we don't want to expose it for now at least.

src/Uno.Foundation/Size.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Windows.Foundation;
99

1010
[DebuggerDisplay("{DebugDisplay,nq}")]
1111
[TypeConverter(typeof(SizeConverter))]
12+
[Uno.Foundation.Internals.Bindable]
1213
public partial struct Size
1314
{
1415
// These are public in WinUI (with the underscore!), but we don't want to expose it for now at least.

0 commit comments

Comments
 (0)