Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue21112.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public class Issue21112ViewModel
{
public ICommand NavigateCommand { get; set; }

[UnconditionalSuppressMessage("TrimAnalysis", "IL2111",
Justification = "The lambda expression in NavigateCommand is only used with known page types that have public parameterless constructors.")]
public Issue21112ViewModel()
{
NavigateCommand = new Command<Type>(async ([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type pageType) =>
Expand Down
20 changes: 20 additions & 0 deletions src/Controls/tests/TestCases.HostApp/TestCases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,24 @@ public class TestCaseScreen : CollectionView
{
public static Dictionary<string, Action> PageToAction = new Dictionary<string, Action>(StringComparer.OrdinalIgnoreCase);

[UnconditionalSuppressMessage("TrimAnalysis", "IL2112",
Justification = "TestCaseScreen fields are not accessed via reflection in NativeAOT builds since reflection-based test discovery is disabled.")]
bool _filterBugzilla;

[UnconditionalSuppressMessage("TrimAnalysis", "IL2112",
Justification = "TestCaseScreen fields are not accessed via reflection in NativeAOT builds since reflection-based test discovery is disabled.")]
bool _filterNone;

[UnconditionalSuppressMessage("TrimAnalysis", "IL2112",
Justification = "TestCaseScreen fields are not accessed via reflection in NativeAOT builds since reflection-based test discovery is disabled.")]
bool _filterGitHub;

[UnconditionalSuppressMessage("TrimAnalysis", "IL2112",
Justification = "TestCaseScreen fields are not accessed via reflection in NativeAOT builds since reflection-based test discovery is disabled.")]
bool _filterManual;

[UnconditionalSuppressMessage("TrimAnalysis", "IL2112",
Justification = "TestCaseScreen fields are not accessed via reflection in NativeAOT builds since reflection-based test discovery is disabled.")]
string _filter;
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same UnconditionalSuppressMessage attribute is repeated 5 times with identical parameters. Consider extracting this into a constant or applying it at the class level if possible, or create a custom attribute to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.

void CheckInternetAndLoadPage(Type type)
Expand Down Expand Up @@ -88,6 +102,8 @@ Action ActivatePageAndNavigate(IssueAttribute issueAttribute, Type type)
return navigationAction;
}

[UnconditionalSuppressMessage("TrimAnalysis", "IL2026",
Justification = "ActivatePage method is only called in non-NativeAOT builds where reflection-based test discovery is enabled.")]
Page ActivatePage([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type type)
{
var page = Activator.CreateInstance(type) as Page;
Expand Down Expand Up @@ -136,6 +152,8 @@ public bool Matches(string filter)
}
}

[UnconditionalSuppressMessage("TrimAnalysis", "IL2112",
Justification = "TestCaseScreen fields are not accessed via reflection in NativeAOT builds since reflection-based test discovery is disabled.")]
readonly List<IssueModel> _issues;

void VerifyNoDuplicates()
Expand Down Expand Up @@ -322,6 +340,8 @@ from issueModel in _issues
ItemsSource = issues;
}

[UnconditionalSuppressMessage("TrimAnalysis", "IL2112",
Justification = "TestCaseScreen fields are not accessed via reflection in NativeAOT builds since reflection-based test discovery is disabled.")]
HashSet<string> _exemptNames = new HashSet<string> { };

// Legacy reasons, do not add to this list
Expand Down
Loading