Skip to content

Commit 9fae7ac

Browse files
authored
Enable AoT for net8 in Release (#417)
* WinAppSdk AoT dynamic and unreference code suppression * WinAppSdk AoT dynamic and unreference code suppression * Update tooling pointer * Update tooling pointer * Updated tooling to latest main * Update components/Collections/src/IncrementalLoadingCollection/IncrementalLoadingCollection.cs Resolves https://github.com/CommunityToolkit/Windows/pull/417/files/8592e3a87b9b2bccd42d4320059df5a34f516a1c#r1607419411
1 parent 449cfea commit 9fae7ac

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed

components/Collections/samples/IncrementalLoadingCollectionSample.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public IncrementalLoadingCollectionSample()
1717
private void Load()
1818
{
1919
// IncrementalLoadingCollection can be bound to a GridView or a ListView. In this case it is a ListView called PeopleListView.
20-
var collection = new IncrementalLoadingCollection<PeopleSource, Person>();
20+
var collection = new IncrementalLoadingCollection<PeopleSource, Person>(new PeopleSource());
2121
PeopleListView.ItemsSource = collection;
2222

2323
// Binds the collection to the page DataContext in order to use its IsLoading and HasMoreItems properties.

components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ namespace CommunityToolkit.WinUI.Collections;
1313
/// <summary>
1414
/// A collection view implementation that supports filtering, sorting and incremental loading
1515
/// </summary>
16+
#if NET8_0_OR_GREATER
17+
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Item sorting uses reflection to get property types and may not be AOT compatible.")]
18+
#endif
1619
public partial class AdvancedCollectionView : IAdvancedCollectionView, INotifyPropertyChanged, ISupportIncrementalLoading, IComparer<object>
1720
{
1821
private readonly List<object> _view;

components/Collections/src/IncrementalLoadingCollection/IncrementalLoadingCollection.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ private set
130130
/// An <see cref="Action"/> that is called if an error occurs during data retrieval.
131131
/// </param>
132132
/// <seealso cref="IIncrementalSource{TSource}"/>
133+
#if NET8_0_OR_GREATER
134+
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This constructor is not AOT compatible and will be removed in a future version.")]
135+
#endif
136+
[EditorBrowsable(EditorBrowsableState.Never)]
137+
[Obsolete("This constructor is not AOT compatible and will be removed in a future version. Use the other constructor and provide a source collection to use.")]
133138
public IncrementalLoadingCollection(int itemsPerPage = 20, Action onStartLoading = null, Action onEndLoading = null, Action<Exception> onError = null)
134139
: this(Activator.CreateInstance<TSource>(), itemsPerPage, onStartLoading, onEndLoading, onError)
135140
{

components/Converters/src/TaskResultConverter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ namespace CommunityToolkit.WinUI.Converters;
1414
/// The methods in this converter will safely return <see langword="null"/> if the input
1515
/// task is not set yet, still running, has faulted, or has been canceled.
1616
/// </summary>
17+
#if NET8_0_OR_GREATER
18+
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This method uses reflection to try to access the Task<T>.Result property of the input Task instance.")]
19+
#endif
1720
public sealed class TaskResultConverter : IValueConverter
1821
{
1922
/// <inheritdoc/>

components/Extensions/src/Markup/EnumValuesExtension.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ namespace CommunityToolkit.WinUI;
88
/// A markup extension that returns a collection of values of a specific <see langword="enum"/>
99
/// </summary>
1010
[MarkupExtensionReturnType(ReturnType = typeof(Array))]
11+
#if NET8_0_OR_GREATER
12+
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("It might not be possible to create an array of a user-defined enum type at runtime.")]
13+
#endif
1114
public sealed class EnumValuesExtension : MarkupExtension
1215
{
1316
/// <summary>

0 commit comments

Comments
 (0)