From b4f75aebd39b9f5a6751486bb01ef61b91270d74 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 13 May 2026 21:52:21 +0200 Subject: [PATCH 1/5] Enable TreatWarningsAsErrors and fix all warnings - Enable TreatWarningsAsErrors in Directory.Build.props for the whole repo - Add CheckEolWorkloads/CheckEolTargetFramework for .NET 11 preview SDK - Fix 152 XC0022 warnings: add x:DataType to all XAML pages and DataTemplates - Fix 24 XC0025 warnings: refactor Source= bindings to ViewModel patterns - CollectionView SelectedItem bound to ViewModel properties - ControlTemplate uses TemplateBinding instead of RelativeSource - DataTrigger validation moved to ViewModel CanExecute - Fix nullability warnings in FilteredCollectionView.cs (object?, null guards) - Fix nullability warnings in FileSystemUtils.cs (Android null checks) - Fix CS0618: replace deprecated DelegatingExecutionSummarySink and DelegatingLongRunningTestDetectionSink with ExecutionSink - Fix CS0618: replace deprecated MainPage setter with CreateWindow override - Fix XC0045: correct TestResultStatus binding to ResultStatus (caught by compiled bindings - was a silent runtime failure before) - Fix xUnit1026: use DataTest parameter in assertion - Remove unnecessary System.Security.Cryptography.X509Certificates package (already in .NET 9+ framework) - Disable generated TestingPlatform entry point (MAUI app has its own) - Exclude test library runtimeconfig.json from app bundle - Suppress CA2255 for intentional ModuleInitializer in UITesting.Maui Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Directory.Build.props | 7 +++++ Directory.Packages.props | 1 - sample/src/DeviceTestingKitApp/App.xaml.cs | 5 +++- .../DeviceTestingKitApp.DeviceTests.csproj | 11 +++++++ .../Tests/UITests/TestPage.xaml | 19 ++---------- .../Tests/UITests/TestViewModel.cs | 6 +++- .../DeviceRunners.Cli.csproj | 1 - .../DeviceRunners.UITesting.Maui.csproj | 2 ++ .../DeviceRunners.VisualRunners.Core.csproj | 1 - .../App/Pages/CreditsPage.xaml | 2 ++ .../App/Pages/DiagnosticsPage.xaml | 2 ++ .../App/Pages/HomePage.xaml | 9 +++--- .../App/Pages/TestAssemblyPage.xaml | 6 ++-- .../App/Pages/TestResultPage.xaml | 2 ++ .../App/VisualRunnerApp.xaml | 6 ++-- .../App/VisualRunnerAppShell.xaml | 2 +- .../XunitTestRunner.cs | 10 +++++-- .../Utils/FileSystemUtils.cs | 5 ++-- .../Utils/FilteredCollectionView.cs | 30 +++++++++---------- .../ViewModels/HomeViewModel.cs | 22 +++++++------- .../ViewModels/TestAssemblyViewModel.cs | 19 ++++++++---- test/TestProject.Tests/XunitTests.cs | 2 +- 22 files changed, 102 insertions(+), 68 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7928b323f..08e472cc9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,6 +13,13 @@ false + + + true + + + false + false \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index cd46cb5c8..fea945873 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -19,7 +19,6 @@ - diff --git a/sample/src/DeviceTestingKitApp/App.xaml.cs b/sample/src/DeviceTestingKitApp/App.xaml.cs index e2c85c2b8..19cb2083b 100644 --- a/sample/src/DeviceTestingKitApp/App.xaml.cs +++ b/sample/src/DeviceTestingKitApp/App.xaml.cs @@ -5,7 +5,10 @@ public partial class App : Application public App() { InitializeComponent(); + } - MainPage = new AppShell(); + protected override Window CreateWindow(IActivationState? activationState) + { + return new Window(new AppShell()); } } diff --git a/sample/test/DeviceTestingKitApp.DeviceTests/DeviceTestingKitApp.DeviceTests.csproj b/sample/test/DeviceTestingKitApp.DeviceTests/DeviceTestingKitApp.DeviceTests.csproj index d1106902a..3223349fd 100644 --- a/sample/test/DeviceTestingKitApp.DeviceTests/DeviceTestingKitApp.DeviceTests.csproj +++ b/sample/test/DeviceTestingKitApp.DeviceTests/DeviceTestingKitApp.DeviceTests.csproj @@ -21,6 +21,9 @@ 1.0 1 + + + false @@ -79,4 +82,12 @@ + + + + + + + diff --git a/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestPage.xaml b/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestPage.xaml index cdc92b4c0..1714db159 100644 --- a/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestPage.xaml +++ b/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestPage.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="using:DeviceTestingKitApp.DeviceTests" x:Class="DeviceTestingKitApp.DeviceTests.TestPage" + x:DataType="local:TestViewModel" Shell.PresentationMode="ModalAnimated"> @@ -26,22 +27,8 @@ + Command="{Binding LoginCommand}" + MaximumWidthRequest="100" /> diff --git a/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestViewModel.cs b/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestViewModel.cs index 4f352d255..a7ba42822 100644 --- a/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestViewModel.cs +++ b/sample/test/DeviceTestingKitApp.DeviceTests/Tests/UITests/TestViewModel.cs @@ -9,7 +9,7 @@ public class TestViewModel : BindableObject public TestViewModel() { - LoginCommand = new Command(OnLogin); + LoginCommand = new Command(OnLogin, CanLogin); } public string? Username @@ -19,6 +19,7 @@ public string? Username { _username = value; OnPropertyChanged(); + ((Command)LoginCommand).ChangeCanExecute(); } } @@ -29,11 +30,14 @@ public string? Password { _password = value; OnPropertyChanged(); + ((Command)LoginCommand).ChangeCanExecute(); } } public ICommand LoginCommand { get; } + bool CanLogin() => !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password); + void OnLogin() { // ... diff --git a/src/DeviceRunners.Cli/DeviceRunners.Cli.csproj b/src/DeviceRunners.Cli/DeviceRunners.Cli.csproj index c54412bf0..c25a4a463 100644 --- a/src/DeviceRunners.Cli/DeviceRunners.Cli.csproj +++ b/src/DeviceRunners.Cli/DeviceRunners.Cli.csproj @@ -17,7 +17,6 @@ - diff --git a/src/DeviceRunners.UITesting.Maui/DeviceRunners.UITesting.Maui.csproj b/src/DeviceRunners.UITesting.Maui/DeviceRunners.UITesting.Maui.csproj index 93fea68e9..14c8d4939 100644 --- a/src/DeviceRunners.UITesting.Maui/DeviceRunners.UITesting.Maui.csproj +++ b/src/DeviceRunners.UITesting.Maui/DeviceRunners.UITesting.Maui.csproj @@ -5,6 +5,8 @@ true true true + + CA2255 diff --git a/src/DeviceRunners.VisualRunners.Core/DeviceRunners.VisualRunners.Core.csproj b/src/DeviceRunners.VisualRunners.Core/DeviceRunners.VisualRunners.Core.csproj index 8e2c5f4b2..7b31a9094 100644 --- a/src/DeviceRunners.VisualRunners.Core/DeviceRunners.VisualRunners.Core.csproj +++ b/src/DeviceRunners.VisualRunners.Core/DeviceRunners.VisualRunners.Core.csproj @@ -4,7 +4,6 @@ net9.0;net10.0 DeviceRunners.VisualRunners Core cross-platform types for DeviceRunners visual test runners (result channels, formatters, test events). - true diff --git a/src/DeviceRunners.VisualRunners.Maui/App/Pages/CreditsPage.xaml b/src/DeviceRunners.VisualRunners.Maui/App/Pages/CreditsPage.xaml index f6512bd19..eba916089 100644 --- a/src/DeviceRunners.VisualRunners.Maui/App/Pages/CreditsPage.xaml +++ b/src/DeviceRunners.VisualRunners.Maui/App/Pages/CreditsPage.xaml @@ -1,8 +1,10 @@  diff --git a/src/DeviceRunners.VisualRunners.Maui/App/Pages/DiagnosticsPage.xaml b/src/DeviceRunners.VisualRunners.Maui/App/Pages/DiagnosticsPage.xaml index aa81ffac9..f9a3fd2f4 100644 --- a/src/DeviceRunners.VisualRunners.Maui/App/Pages/DiagnosticsPage.xaml +++ b/src/DeviceRunners.VisualRunners.Maui/App/Pages/DiagnosticsPage.xaml @@ -1,8 +1,10 @@  diff --git a/src/DeviceRunners.VisualRunners.Maui/App/Pages/HomePage.xaml b/src/DeviceRunners.VisualRunners.Maui/App/Pages/HomePage.xaml index 43629eec6..df6b6c543 100644 --- a/src/DeviceRunners.VisualRunners.Maui/App/Pages/HomePage.xaml +++ b/src/DeviceRunners.VisualRunners.Maui/App/Pages/HomePage.xaml @@ -1,8 +1,10 @@  - + -