From 7d9c8eeb7ba5da48e4ce06ce3efc24ceb3e248fc Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 2 Feb 2026 12:07:00 -0800 Subject: [PATCH] Fix warnings and index bugs in ControlCatalog sample (#20590) --- samples/ControlCatalog.Desktop/Program.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/ControlCatalog.Desktop/Program.cs b/samples/ControlCatalog.Desktop/Program.cs index c4c42a7311..2037b85695 100644 --- a/samples/ControlCatalog.Desktop/Program.cs +++ b/samples/ControlCatalog.Desktop/Program.cs @@ -45,7 +45,7 @@ namespace ControlCatalog.Desktop double GetScaling() { var idx = Array.IndexOf(args, "--scaling"); - if (idx != 0 && args.Length > idx + 1 && + if (idx >= 0 && args.Length > idx + 1 && double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling)) return scaling; return 1; @@ -114,7 +114,7 @@ namespace ControlCatalog.Desktop { builder.With(new Win32PlatformOptions() { - CompositionMode = new [] { Win32CompositionMode.LowLatencyDxgiSwapChain } + CompositionMode = [Win32CompositionMode.LowLatencyDxgiSwapChain] }); return builder.StartWithClassicDesktopLifetime(args); } @@ -151,14 +151,14 @@ namespace ControlCatalog.Desktop .WithDeveloperTools() .AfterSetup(builder => { - EmbedSample.Implementation = OperatingSystem.IsWindows() ? (INativeDemoControl)new EmbedSampleWin() + EmbedSample.Implementation = OperatingSystem.IsWindows() ? new EmbedSampleWin() : OperatingSystem.IsMacOS() ? new EmbedSampleMac() : OperatingSystem.IsLinux() ? new EmbedSampleGtk() : null; }) .LogToTrace(); - static void SilenceConsole() + private static void SilenceConsole() { new Thread(() => {