From b2b2856e5292767214239c2fb0517a9083129ac2 Mon Sep 17 00:00:00 2001 From: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> Date: Wed, 22 Nov 2023 12:46:59 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20[Dev][Build]=20.NET=208=20Upgrad?= =?UTF-8?q?e=20(#28655)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Upgraded projects to target .NET 8 * Updated .NET runtime package targets to use latest .NET 8 build * Updated PowerToys Interop to target .NET 8 * Switch to use ArgumentNullException.ThrowIfNull * ArgumentNullException.ThrowIfNull for CropAndLockViewModel * Switching to ObjectDisposedException.ThrowIf * Upgrade System.ComponentModel.Composition to 8.0 * ArgumentNullException.ThrowIfNull in Helper * Switch to StartsWith using StringComparison.Ordinal * Disabled CA1859, CA1716, SYSLIB1096 analyzers * Update RIDs to reflect breaking changes in .NET 8 * Updated Microsoft NuGet packages to RC1 * Updated Analyzer package to latest .NET 8 preview package * CA1854: Use TryGetValue instead of ContainsKey * [Build] Update TFM to .NET 8 for publish profiles * [Analyzers] Remove CA1309, CA1860-CA1865, CA1869, CA2208 from warning. * [Analyzers] Fix for C26495 * [Analyzers] Disable CS1615, CS9191 * [CI] Target .NET 8 in YAML * [CI] Add .NET preview version flag temporarily. * [FileLocksmith] Update TFM to .NET 8 * [CI] Switch to preview agent * [CI] Update NOTICE.md * [CI] Update Release to target .NET 8 and use Preview agent * [Analyzers] Disable CA1854 * Fix typo * Updated Microsoft.CodeAnalysis.NetAnalyzers to latest preview Updated packages to rc2 * [Analyzers][CPP] Turn off warning for 5271 * [Analyzers][CPP] Turn off warning for 26493 * [KeyboardListener] Add mutex include to resolve error * [PT Run][Folder] Use static SearchValues to resolve CA1870 * [PowerLauncher] Fix TryGetValue * [MouseJumpSettings] Use ArgumentNullException.ThrowIfNull * [Build] Disable parallel dotnet tool restore * [Build] No cache of dotnet tool packages * [Build] Temporarily move .NET 8 SDK task before XAML formatting * [Build][Temp] Try using .NET 7 prior to XAML formatting and then switch to .NET 8 after * [Build] Use .NET 6 for XAML Styler * [CI] Updated NOTICE.md * [FancyZones] Update TFM to .NET 8 * [EnvVar] Update TFM to .NET 8 and update RID * [EnvVar] Use ArgumentNullException.ThrowIfNull * [Dev] Updated packages to .NET 8 RTM version * [Dev] Updated Microsoft.CodeAnalysis.NetAnalyzers to latest * [CI] Updated NOTICE.md with latest package versions * Fix new utility target fameworks and runtimeids * Don't use preview images anymore * [CI] Add script to update VCToolsVersion environment variable * [CI] Add Step to Verify VCToolsVersion * [CI] Use latest flag for vswhere to set proper VCToolsVersion * Add VCToolsVersion checking to release.yml * Remove net publishing from local/ PR CI builds * Revert "Remove net publishing from local/ PR CI builds" This reverts commit f469778996c5053e8bf93233e8191858c46f6420. * Only publish necessary projects * Add verbosity to release pipelines builds of PowerTOys * Set VCToolsVersion for publish.cmd when called from installer * [Installer] Moved project publish logic to MSBuild Task * [CI] Revert using publish.cmd * [CI] Set VCToolsVersion and unset ClearDevCommandPromptEnvVars property * Installer publishes for x64 too * Revert "Add verbosity to release pipelines builds of PowerTOys" This reverts commit 654d4a7f7852e95e44df315c473c02d38b1f538b. * [Dev] Update CodeAnalysis library to non-preview package * Remove unneeded warning removal * Fix Notice.md * Rename VCToolsVersion file and task name * Remove unneeded mutex header include --------- Co-authored-by: Jaime Bernardo --- .pipelines/applyXamlStyling.ps1 | 2 +- .../ci/templates/build-powertoys-steps.yml | 17 ++++++- .pipelines/release.yml | 10 ++++- .../verifyAndSetLatestVCToolsVersion.ps1 | 5 +++ Directory.Packages.props | 30 ++++++------- NOTICE.md | 31 +++++++------ .../PowerToysSetup/PowerToysInstaller.wixproj | 6 +-- installer/PowerToysSetup/publish.cmd | 9 +--- src/.editorconfig | 45 +++++++++++++++++++ .../AllExperiments/AllExperiments.csproj | 2 +- src/common/AllExperiments/Experiments.cs | 11 ++--- src/common/Common.UI/Common.UI.csproj | 2 +- .../FilePreviewCommon.csproj | 2 +- .../GPOWrapperProjection.csproj | 2 +- src/common/ManagedCommon/ColorFormatHelper.cs | 6 +-- src/common/ManagedCommon/ManagedCommon.csproj | 2 +- .../Telemetry/ManagedTelemetry.csproj | 2 +- src/common/interop/PowerToys.Interop.vcxproj | 2 +- .../Microsoft.Interop.Tests.csproj | 2 +- .../EnvironmentVariables.csproj | 8 ++-- .../FileLocksmithLibInterop.vcxproj | 2 +- .../FileLocksmithUI/FileLocksmithUI.csproj | 8 ++-- .../InstallationPublishProfile.pubxml | 4 +- .../Hosts/Hosts.Tests/Hosts.Tests.csproj | 4 +- src/modules/Hosts/Hosts/Hosts.csproj | 8 ++-- .../Hosts/HostsModuleInterface/dllmain.cpp | 4 +- .../MeasureToolUI/MeasureToolUI.csproj | 8 ++-- .../MouseJumpUI.UnitTests.csproj | 2 +- .../MouseJumpUI/Helpers/LayoutHelper.cs | 5 +-- .../MouseUtils/MouseJumpUI/MouseJumpUI.csproj | 6 +-- .../App/Class/Common.Encryption.cs | 4 +- .../Helper/MouseWithoutBordersHelper.csproj | 6 +-- .../App/MouseWithoutBorders.csproj | 6 +-- .../Service/MouseWithoutBordersService.csproj | 6 +-- .../PowerOCR/Helpers/WrappingStream.cs | 5 +-- src/modules/PowerOCR/PowerOCR/PowerOCR.csproj | 6 +-- src/modules/awake/Awake/Awake.csproj | 6 +-- .../awake/Awake/Core/ExtensionMethods.cs | 10 +---- .../ColorPickerUI/ColorPickerUI.csproj | 6 +-- .../Common/RangeObservableCollection.cs | 5 +-- .../UnitTest-ColorPickerUI.csproj | 2 +- .../UnitTests-FancyZonesEditor.csproj | 2 +- .../FancyZonesEditor/FancyZonesEditor.csproj | 6 +-- .../Models/LayoutHotkeysModel.cs | 4 +- .../FancyZonesEditor/Utils/RelayCommand.cs | 5 +-- .../FancyZonesEditor/Utils/RelayCommand`1.cs | 5 +-- .../tests/ImageResizerUITest.csproj | 2 +- .../imageresizer/ui/ImageResizerUI.csproj | 6 +-- ...s.Run.Plugin.UnitConverter.UnitTest.csproj | 2 +- ....PowerToys.Run.Plugin.UnitConverter.csproj | 2 +- .../Main.cs | 10 +---- ...werToys.Run.Plugin.VSCodeWorkspaces.csproj | 2 +- ...Run.Plugin.ValueGenerator.UnitTests.csproj | 2 +- ...PowerToys.Run.Plugin.ValueGenerator.csproj | 2 +- .../Main.cs | 5 +-- ...nity.PowerToys.Run.Plugin.WebSearch.csproj | 2 +- .../Main.cs | 5 +-- .../Microsoft.Plugin.Folder.UnitTests.csproj | 2 +- .../EnvironmentVariableProcessor.cs | 5 +-- .../Plugins/Microsoft.Plugin.Folder/Main.cs | 10 +---- .../Microsoft.Plugin.Folder.csproj | 2 +- .../Sources/EnvironmentHelper.cs | 5 +-- .../Sources/Path/FolderHelper.cs | 15 ++----- .../Sources/QueryEnvironmentVariable.cs | 5 +-- .../Sources/QueryInternalDirectory.cs | 9 ++-- .../Sources/ShellAction.cs | 10 +---- .../Microsoft.Plugin.Indexer.csproj | 2 +- .../SearchHelper/WindowsSearchAPI.cs | 25 +++-------- .../Microsoft.Plugin.Program.UnitTests.csproj | 2 +- .../Plugins/Microsoft.Plugin.Program/Main.cs | 15 ++----- .../Microsoft.Plugin.Program.csproj | 2 +- .../Programs/PackageWrapper.cs | 5 +-- .../Microsoft.Plugin.Program/Programs/UWP.cs | 5 +-- .../Programs/UWPApplication.cs | 15 ++----- .../Programs/Win32Program.cs | 25 +++-------- .../Storage/EventHandler.cs | 5 +-- .../Plugins/Microsoft.Plugin.Shell/Main.cs | 5 +-- .../Microsoft.Plugin.Shell.csproj | 2 +- .../Microsoft.Plugin.Uri.UnitTests.csproj | 2 +- .../Microsoft.Plugin.Uri.csproj | 2 +- ...osoft.Plugin.WindowWalker.UnitTests.csproj | 2 +- .../Components/FuzzyMatching.cs | 20 ++------- .../Microsoft.Plugin.WindowWalker/Main.cs | 5 +-- .../Microsoft.Plugin.WindowWalker.csproj | 2 +- ...Toys.Run.Plugin.Calculator.UnitTest.csproj | 2 +- ...oft.PowerToys.Run.Plugin.Calculator.csproj | 2 +- .../NumberTranslator.cs | 10 +---- ...rosoft.PowerToys.Run.Plugin.History.csproj | 2 +- ...rosoft.PowerToys.Run.Plugin.OneNote.csproj | 2 +- ...soft.PowerToys.Run.Plugin.PowerToys.csproj | 2 +- ...rToys.Run.Plugin.Registry.UnitTests.csproj | 2 +- ...osoft.PowerToys.Run.Plugin.Registry.csproj | 2 +- .../Helpers/ServiceHelper.cs | 15 ++----- ...rosoft.PowerToys.Run.Plugin.Service.csproj | 2 +- .../ServiceResult.cs | 5 +-- ...werToys.Run.Plugin.System.UnitTests.csproj | 2 +- ...crosoft.PowerToys.Run.Plugin.System.csproj | 2 +- ...rToys.Run.Plugin.TimeDate.UnitTests.csproj | 2 +- .../Main.cs | 5 +-- ...osoft.PowerToys.Run.Plugin.TimeDate.csproj | 2 +- ...owerToys.Run.Plugin.WindowsSettings.csproj | 2 +- ...ft.Plugin.WindowsTerminal.UnitTests.csproj | 2 +- .../Main.cs | 7 +-- ...owerToys.Run.Plugin.WindowsTerminal.csproj | 2 +- .../PowerLauncher.Telemetry.csproj | 2 +- .../PowerLauncher/Helper/DragDataObject.cs | 5 +-- .../PowerLauncher/Helper/EnvironmentHelper.cs | 4 +- .../PowerLauncher/Helper/FontHelper.cs | 10 +---- .../PowerLauncher/Plugin/PluginManager.cs | 15 ++----- .../PowerLauncher/Plugin/QueryBuilder.cs | 5 +-- .../PowerLauncher/PowerLauncher.csproj | 6 +-- .../InstallationPublishProfile.pubxml | 2 +- .../launcher/PowerLauncher/SettingsReader.cs | 14 +++--- .../PowerLauncher/ViewModel/MainViewModel.cs | 16 +++---- .../ViewModel/ResultsViewModel.cs | 5 +-- .../launcher/Wox.Infrastructure/Alphabet.cs | 4 +- .../Wox.Infrastructure/FuzzyMatcher.cs | 10 +---- .../launcher/Wox.Infrastructure/Stopwatch.cs | 15 ++----- .../Storage/StoragePowerToysVersionInfo.cs | 5 +-- .../Wox.Infrastructure/StringMatcher.cs | 5 +-- .../Wox.Infrastructure.csproj | 2 +- .../launcher/Wox.Plugin/AllowedLanguage.cs | 5 +-- .../Wox.Plugin/Common/ShellCommand.cs | 5 +-- src/modules/launcher/Wox.Plugin/Logger/Log.cs | 25 +++-------- src/modules/launcher/Wox.Plugin/Result.cs | 5 +-- .../launcher/Wox.Plugin/UserSelectedRecord.cs | 15 ++----- .../launcher/Wox.Plugin/Wox.Plugin.csproj | 2 +- src/modules/launcher/Wox.Test/Wox.Test.csproj | 2 +- .../peek/Peek.Common/Peek.Common.csproj | 4 +- .../Peek.FilePreviewer.csproj | 4 +- src/modules/peek/Peek.UI/Peek.UI.csproj | 8 ++-- .../PowerAccent.Core/PowerAccent.Core.csproj | 6 +-- .../PowerAccent.UI/PowerAccent.UI.csproj | 6 +-- .../KeyboardListener.h | 3 +- .../GcodePreviewHandler.csproj | 6 +-- .../GcodeThumbnailProvider.csproj | 6 +-- .../MarkdownPreviewHandler.csproj | 8 ++-- .../InstallationPublishProfile.pubxml | 4 +- .../MonacoPreviewHandler.csproj | 8 ++-- .../InstallationPublishProfile.pubxml | 4 +- .../PdfPreviewHandler.csproj | 6 +-- .../PdfThumbnailProvider.csproj | 6 +-- .../QoiPreviewHandler.csproj | 6 +-- .../QoiThumbnailProvider.csproj | 6 +-- .../previewpane/STATestMethodAttribute.cs | 5 +-- .../StlThumbnailProvider.csproj | 6 +-- .../InstallationPublishProfile.pubxml | 4 +- .../SvgPreviewHandler.csproj | 8 ++-- .../InstallationPublishProfile.pubxml | 4 +- .../SvgThumbnailProvider.csproj | 8 ++-- .../UnitTests-GcodePreviewHandler.csproj | 2 +- .../UnitTests-GcodeThumbnailProvider.csproj | 2 +- .../UnitTests-MarkdownPreviewHandler.csproj | 2 +- .../UnitTests-PdfPreviewHandler.csproj | 2 +- .../UnitTests-PdfThumbnailProvider.csproj | 2 +- .../UnitTests-PreviewHandlerCommon.csproj | 2 +- .../UnitTests-QoiPreviewHandler.csproj | 2 +- .../UnitTests-QoiThumbnailProvider.csproj | 2 +- .../UnitTests-StlThumbnailProvider.csproj | 2 +- .../UnitTests-SvgPreviewHandler.csproj | 2 +- .../UnitTests-SvgThumbnailProvider.csproj | 2 +- .../common/PreviewHandlerCommon.csproj | 2 +- .../common/Utilities/ReadonlyStream.cs | 5 +-- .../RegistryPreviewUI.csproj | 6 +-- .../AppSpecificKeysDataModel.cs | 5 +-- .../ColorPickerSettings.cs | 5 +-- .../ColorPickerSettingsVersion1.cs | 5 +-- .../EnvironmentVariablesSettings.cs | 5 +-- .../FileLocksmithSettings.cs | 5 +-- .../Settings.UI.Library/HostsSettings.cs | 5 +-- .../Settings.UI.Library/ImageSize.cs | 5 +-- .../Settings.UI.Library/MouseJumpSettings.cs | 5 +-- .../MouseWithoutBordersSettings.cs | 5 +-- .../Settings.UI.Library/PastePlainSettings.cs | 5 +-- .../Settings.UI.Library/PeekSettings.cs | 5 +-- .../PowerLauncherSettings.cs | 5 +-- .../Settings.UI.Library/PowerOcrSettings.cs | 5 +-- .../PowerRenameSettings.cs | 5 +-- .../Settings.UI.Library.csproj | 6 +-- .../SettingsBackupAndRestoreUtils.cs | 10 +---- .../Settings.UI.Library/Utilities/Helper.cs | 10 +---- .../BackCompatTestProperties.cs | 10 +---- .../Settings.UI.UnitTests.csproj | 4 +- .../Settings.UI/PowerToys.Settings.csproj | 8 ++-- .../InstallationPublishProfile.pubxml | 4 +- .../ViewModels/AlwaysOnTopViewModel.cs | 15 ++----- .../ViewModels/ColorPickerViewModel.cs | 5 +-- .../ViewModels/CropAndLockViewModel.cs | 15 ++----- .../ViewModels/FancyZonesViewModel.cs | 15 ++----- .../ViewModels/FileLocksmithViewModel.cs | 5 +-- .../ViewModels/GeneralViewModel.cs | 5 +-- .../ViewModels/ImageResizerViewModel.cs | 5 +-- .../ViewModels/KeyboardManagerViewModel.cs | 5 +-- .../ViewModels/MeasureToolViewModel.cs | 10 +---- .../ViewModels/MouseUtilsViewModel.cs | 25 +++-------- .../MouseWithoutBordersViewModel.cs | 10 +---- .../ViewModels/PastePlainViewModel.cs | 15 ++----- .../Settings.UI/ViewModels/PeekViewModel.cs | 5 +-- .../ViewModels/PowerAccentViewModel.cs | 5 +-- .../ViewModels/PowerLauncherViewModel.cs | 5 +-- .../ViewModels/PowerOcrViewModel.cs | 15 ++----- .../ViewModels/PowerPreviewViewModel.cs | 10 +---- .../ViewModels/PowerRenameViewModel.cs | 5 +-- .../ViewModels/RegistryPreviewViewModel.cs | 5 +-- .../ViewModels/ShortcutGuideViewModel.cs | 10 +---- .../ViewModels/VideoConferenceViewModel.cs | 10 +---- 206 files changed, 473 insertions(+), 841 deletions(-) create mode 100644 .pipelines/verifyAndSetLatestVCToolsVersion.ps1 diff --git a/.pipelines/applyXamlStyling.ps1 b/.pipelines/applyXamlStyling.ps1 index 8f890d2a91..c360d18a03 100644 --- a/.pipelines/applyXamlStyling.ps1 +++ b/.pipelines/applyXamlStyling.ps1 @@ -39,7 +39,7 @@ param( Write-Output "Use 'Help .\applyXamlStyling.ps1' for more info or '-Main' to run against all files." Write-Output "" Write-Output "Restoring dotnet tools..." -dotnet tool restore +dotnet tool restore --disable-parallel --no-cache if (-not $Passive) { diff --git a/.pipelines/ci/templates/build-powertoys-steps.yml b/.pipelines/ci/templates/build-powertoys-steps.yml index 23cd60f191..d151a39257 100644 --- a/.pipelines/ci/templates/build-powertoys-steps.yml +++ b/.pipelines/ci/templates/build-powertoys-steps.yml @@ -7,6 +7,12 @@ steps: submodules: true clean: true +- task: UseDotNet@2 + displayName: 'Use .NET 6 SDK' + inputs: + packageType: sdk + version: '6.x' + - task: PowerShell@2 displayName: Verify XAML formatting inputs: @@ -56,11 +62,18 @@ steps: arguments: -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' pwsh: true +- task: PowerShell@2 + displayName: Verify and set latest VCToolsVersion usage + inputs: + filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' + pwsh: true + - task: UseDotNet@2 - displayName: 'Use .NET 7 SDK' + displayName: 'Use .NET 8 SDK' inputs: packageType: sdk - version: '7.x' + version: '8.x' + includePreviewVersions: true - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform diff --git a/.pipelines/release.yml b/.pipelines/release.yml index ae62f47df7..d28596e0f6 100644 --- a/.pipelines/release.yml +++ b/.pipelines/release.yml @@ -88,10 +88,16 @@ extends: version: '6.x' - task: UseDotNet@2 - displayName: 'Use .NET 7 SDK' + displayName: 'Use .NET 8 SDK' inputs: packageType: sdk - version: '7.x' + version: '8.x' + + - task: PowerShell@2 + displayName: Verify and set latest VCToolsVersion usage + inputs: + filePath: '$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1' + pwsh: true - task: NuGetAuthenticate@1 diff --git a/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 b/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 new file mode 100644 index 0000000000..1644c01e73 --- /dev/null +++ b/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 @@ -0,0 +1,5 @@ +$LatestVCToolsVersion = (([xml](& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -include packages -format xml)).instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.Redist.14.Latest" -and $_.chip -eq "x64" }).version; + +Write-Output "Latest VCToolsVersion: $LatestVCToolsVersion" +Write-Output "Updating VCToolsVersion environment variable for job" +Write-Output "##vso[task.setvariable variable=VCToolsVersion]$LatestVCToolsVersion" \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index 185b6c2159..3044c228f7 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -25,17 +25,17 @@ - - + + - - - - + + + + - + @@ -57,17 +57,17 @@ - - - - + + + + - + - - - + + + diff --git a/NOTICE.md b/NOTICE.md index 0396e96d8c..70984db089 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1270,7 +1270,6 @@ EXHIBIT A -Mozilla Public License. - CommunityToolkit.Mvvm 8.2.0 - CommunityToolkit.WinUI.Animations 8.0.230907 -- CommunityToolkit.WinUI.Collections 8.0.230907 - CommunityToolkit.WinUI.Controls.Primitives 8.0.230907 - CommunityToolkit.WinUI.Controls.Segmented 8.0.230907 - CommunityToolkit.WinUI.Controls.SettingsControls 8.0.230907 @@ -1287,16 +1286,16 @@ EXHIBIT A -Mozilla Public License. - LazyCache 2.4.0 - Mages 2.0.1 - Markdig.Signed 0.27.0 -- Microsoft.CodeAnalysis.NetAnalyzers 7.0.3 -- Microsoft.Data.Sqlite 7.0.0 -- Microsoft.Extensions.DependencyInjection 7.0.0 -- Microsoft.Extensions.Hosting 7.0.1 -- Microsoft.Extensions.Hosting.WindowsServices 7.0.0 -- Microsoft.Extensions.Logging 7.0.0 +- Microsoft.CodeAnalysis.NetAnalyzers 8.0.0 +- Microsoft.Data.Sqlite 8.0.0 +- Microsoft.Extensions.DependencyInjection 8.0.0 +- Microsoft.Extensions.Hosting 8.0.0 +- Microsoft.Extensions.Hosting.WindowsServices 8.0.0 +- Microsoft.Extensions.Logging 8.0.0 - Microsoft.NET.Test.Sdk 17.6.3 - Microsoft.Toolkit.Uwp.Notifications 7.1.2 - Microsoft.Web.WebView2 1.0.2088.41 -- Microsoft.Windows.Compatibility 7.0.3 +- Microsoft.Windows.Compatibility 8.0.0 - Microsoft.Windows.CsWin32 0.2.46-beta - Microsoft.Windows.CsWinRT 2.0.4 - Microsoft.Windows.SDK.BuildTools 10.0.22621.756 @@ -1315,17 +1314,17 @@ EXHIBIT A -Mozilla Public License. - StreamJsonRpc 2.14.24 - StyleCop.Analyzers 1.2.0-beta.507 - System.CommandLine 2.0.0-beta4.22272.1 -- System.ComponentModel.Composition 7.0.0 -- System.Configuration.ConfigurationManager 6.0.0 -- System.Data.OleDb 7.0.0 -- System.Drawing.Common 7.0.0 +- System.ComponentModel.Composition 8.0.0 +- System.Configuration.ConfigurationManager 8.0.0 +- System.Data.OleDb 8.0.0 +- System.Drawing.Common 8.0.0 - System.IO.Abstractions 17.2.3 - System.IO.Abstractions.TestingHelpers 17.2.3 -- System.Management 7.0.2 +- System.Management 8.0.0 - System.Reactive 6.0.0-preview.9 -- System.Runtime.Caching 7.0.0 -- System.ServiceProcess.ServiceController 7.0.1 -- System.Text.Encoding.CodePages 7.0.0 +- System.Runtime.Caching 8.0.0 +- System.ServiceProcess.ServiceController 8.0.0 +- System.Text.Encoding.CodePages 8.0.0 - UnicodeInformation 2.6.0 - UnitsNet 4.145.0 - UTF.Unknown 2.5.1 diff --git a/installer/PowerToysSetup/PowerToysInstaller.wixproj b/installer/PowerToysSetup/PowerToysInstaller.wixproj index 9992d919ae..6a4f3b80cb 100644 --- a/installer/PowerToysSetup/PowerToysInstaller.wixproj +++ b/installer/PowerToysSetup/PowerToysInstaller.wixproj @@ -2,7 +2,6 @@ - Version=$(Version);MonacoSRCHarvestPath=$(ProjectDir)..\..\x64\$(Configuration)\Assets\Monaco\monacoSRC IF NOT DEFINED IsPipeline ( -call "$([MSBuild]::GetVsInstallRoot())\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.19041.0 +call "$([MSBuild]::GetVsInstallRoot())\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.19041.0 -vcvars_ver=$(VCToolsVersion) SET PTRoot=$(SolutionDir)\.. call "..\..\..\publish.cmd" x64 ) @@ -21,7 +20,7 @@ call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuil Version=$(Version);MonacoSRCHarvestPath=$(ProjectDir)..\..\ARM64\$(Configuration)\Assets\Monaco\monacoSRC IF NOT DEFINED IsPipeline ( -call "$([MSBuild]::GetVsInstallRoot())\Common7\Tools\VsDevCmd.bat" -arch=arm64 -host_arch=amd64 -winsdk=10.0.19041.0 +call "$([MSBuild]::GetVsInstallRoot())\Common7\Tools\VsDevCmd.bat" -arch=arm64 -host_arch=amd64 -winsdk=10.0.19041.0 -vcvars_ver=$(VCToolsVersion) SET PTRoot=$(SolutionDir)\.. call "..\..\..\publish.cmd" arm64 ) @@ -194,5 +193,4 @@ call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuil SuppressRegistry="false" SuppressRootDirectory="true"/> - \ No newline at end of file diff --git a/installer/PowerToysSetup/publish.cmd b/installer/PowerToysSetup/publish.cmd index 1baf824d1b..18fa40b4aa 100644 --- a/installer/PowerToysSetup/publish.cmd +++ b/installer/PowerToysSetup/publish.cmd @@ -4,13 +4,10 @@ IF NOT DEFINED PTRoot (SET PTRoot=..\..) SET PlatformArg=%1 IF NOT DEFINED PlatformArg (SET PlatformArg=x64) +SET VCToolsVersion=!VCToolsVersion! +SET ClearDevCommandPromptEnvVars=false rem In case of Release we should not use Debug CRT in VCRT forwarders -msbuild !PTRoot!\src\settings-ui\Settings.UI\PowerToys.Settings.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:PowerToysRoot=!PTRoot! -p:AppxBundle=Never -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml - -rem In case of Release we should not use Debug CRT in VCRT forwarders -msbuild !PTRoot!\src\modules\launcher\PowerLauncher\PowerLauncher.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml - msbuild !PTRoot!\src\modules\previewpane\MonacoPreviewHandler\MonacoPreviewHandler.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml msbuild !PTRoot!\src\modules\previewpane\MarkdownPreviewHandler\MarkdownPreviewHandler.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml @@ -18,5 +15,3 @@ msbuild !PTRoot!\src\modules\previewpane\MarkdownPreviewHandler\MarkdownPreviewH msbuild !PTRoot!\src\modules\previewpane\SvgPreviewHandler\SvgPreviewHandler.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml msbuild !PTRoot!\src\modules\previewpane\SvgThumbnailProvider\SvgThumbnailProvider.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml - -msbuild !PTRoot!\src\modules\FileLocksmith\FileLocksmithUI\FileLocksmithUI.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml diff --git a/src/.editorconfig b/src/.editorconfig index 8a147c55e3..68812c52b9 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -97,3 +97,48 @@ dotnet_diagnostic.IDE0065.severity = none # IDE0009: Add this or Me qualification dotnet_diagnostic.IDE0009.severity = none + +# CA1859: Change type for improved performance +dotnet_diagnostic.CA1859.severity = none + +# CA1716: Identifiers should not match keywords +dotnet_diagnostic.CA1716.severity = none + +# SYSLIB1096: Convert to 'GeneratedComInterface' +dotnet_diagnostic.SYSLIB1096.severity = silent + +# CA1309: Use ordinal StringComparison +dotnet_diagnostic.CA1309.severity = suggestion + +# CS1615: Argument may not be passed with the ref keyword +dotnet_diagnostic.CS1615.severity = none + +# CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup +dotnet_diagnostic.CA1854.severity = suggestion + +# CA1860: Avoid using 'Enumerable.Any()' extension method +dotnet_diagnostic.CA1860.severity = suggestion + +# CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array +dotnet_diagnostic.CA1861.severity = suggestion + +# CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons +dotnet_diagnostic.CA1862.severity = suggestion + +# CA1863: Cache a CompositeFormat for repeated use in this formatting operation +dotnet_diagnostic.CA1863.severity = none + +# CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +dotnet_diagnostic.CA1864.severity = suggestion + +# CA1865: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char +dotnet_diagnostic.CA1865.severity = suggestion + +# CA1869: Cache and reuse 'JsonSerializerOptions' instances +dotnet_diagnostic.CA1869.severity = none + +# CA2208: Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = none + +# CS9191: The 'ref' modifier for argument corresponding to 'in' is equivalent to 'in'. Consider using 'in' instead. +dotnet_diagnostic.CS9191.severity = none diff --git a/src/common/AllExperiments/AllExperiments.csproj b/src/common/AllExperiments/AllExperiments.csproj index 65ca2c95b6..875d8b5d82 100644 --- a/src/common/AllExperiments/AllExperiments.csproj +++ b/src/common/AllExperiments/AllExperiments.csproj @@ -1,7 +1,7 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 enable diff --git a/src/common/AllExperiments/Experiments.cs b/src/common/AllExperiments/Experiments.cs index 38ac694637..426e7af1d1 100644 --- a/src/common/AllExperiments/Experiments.cs +++ b/src/common/AllExperiments/Experiments.cs @@ -76,9 +76,10 @@ namespace AllExperiments if (jsonDictionary != null) { - if (!jsonDictionary.ContainsKey("dataversion")) + if (!jsonDictionary.TryGetValue("dataversion", out object? value)) { - jsonDictionary.Add("dataversion", dataVersion); + value = dataVersion; + jsonDictionary.Add("dataversion", value); } if (!jsonDictionary.ContainsKey("variantassignment")) @@ -87,7 +88,7 @@ namespace AllExperiments } else { - var jsonDataVersion = jsonDictionary["dataversion"].ToString(); + var jsonDataVersion = value.ToString(); if (jsonDataVersion != null && int.Parse(jsonDataVersion, CultureInfo.InvariantCulture) < dataVersion) { jsonDictionary["dataversion"] = dataVersion; @@ -116,9 +117,9 @@ namespace AllExperiments if (jsonDictionary != null) { - if (jsonDictionary.ContainsKey("variantassignment")) + if (jsonDictionary.TryGetValue("variantassignment", out object? value)) { - if (jsonDictionary["variantassignment"].ToString() == "alternate" && AssignmentUnit != string.Empty) + if (value.ToString() == "alternate" && AssignmentUnit != string.Empty) { IsExperiment = true; } diff --git a/src/common/Common.UI/Common.UI.csproj b/src/common/Common.UI/Common.UI.csproj index a4475f640c..102fc3ebbc 100644 --- a/src/common/Common.UI/Common.UI.csproj +++ b/src/common/Common.UI/Common.UI.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows win-x64;win-arm64 true PowerToys.Common.UI diff --git a/src/common/FilePreviewCommon/FilePreviewCommon.csproj b/src/common/FilePreviewCommon/FilePreviewCommon.csproj index b0e64db6f6..f10873559f 100644 --- a/src/common/FilePreviewCommon/FilePreviewCommon.csproj +++ b/src/common/FilePreviewCommon/FilePreviewCommon.csproj @@ -3,7 +3,7 @@ - net7.0-windows + net8.0-windows win-x64;win-arm64 $(Version).0 Microsoft Corporation diff --git a/src/common/GPOWrapperProjection/GPOWrapperProjection.csproj b/src/common/GPOWrapperProjection/GPOWrapperProjection.csproj index 3fd2a3d1b9..5e16a1bae8 100644 --- a/src/common/GPOWrapperProjection/GPOWrapperProjection.csproj +++ b/src/common/GPOWrapperProjection/GPOWrapperProjection.csproj @@ -1,7 +1,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 enable diff --git a/src/common/ManagedCommon/ColorFormatHelper.cs b/src/common/ManagedCommon/ColorFormatHelper.cs index 8c40ea4978..08e62b921d 100644 --- a/src/common/ManagedCommon/ColorFormatHelper.cs +++ b/src/common/ManagedCommon/ColorFormatHelper.cs @@ -328,13 +328,13 @@ namespace ManagedCommon char paramFormat; string paramType = formatString.Substring(formatterPosition + 1, 2); int paramCount = 3; - if (DefaultFormatTypes.ContainsKey(paramType)) + if (DefaultFormatTypes.TryGetValue(paramType, out char value)) { // check the next char, which could be a formatter if (formatterPosition >= formatString.Length - 3) { // not enough characters, end of string, no formatter, use the default one - paramFormat = DefaultFormatTypes[paramType]; + paramFormat = value; paramCount = 2; } else @@ -344,7 +344,7 @@ namespace ManagedCommon // check if it a valid formatter if (!FormatTypeToStringFormatters.ContainsKey(paramFormat)) { - paramFormat = DefaultFormatTypes[paramType]; + paramFormat = value; paramCount = 2; } } diff --git a/src/common/ManagedCommon/ManagedCommon.csproj b/src/common/ManagedCommon/ManagedCommon.csproj index 05f9bd34e1..53ca704109 100644 --- a/src/common/ManagedCommon/ManagedCommon.csproj +++ b/src/common/ManagedCommon/ManagedCommon.csproj @@ -3,7 +3,7 @@ - net7.0-windows + net8.0-windows win-x64;win-arm64 $(Version).0 Microsoft Corporation diff --git a/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj b/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj index 72dfa4fafd..19e1b0015c 100644 --- a/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj +++ b/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows win-x64;win-arm64 $(Version).0 Microsoft Corporation diff --git a/src/common/interop/PowerToys.Interop.vcxproj b/src/common/interop/PowerToys.Interop.vcxproj index 5469432cd0..3f792f85ce 100644 --- a/src/common/interop/PowerToys.Interop.vcxproj +++ b/src/common/interop/PowerToys.Interop.vcxproj @@ -25,7 +25,7 @@ 16.0 {F055103B-F80B-4D0C-BF48-057C55620033} - net7.0-windows + net8.0-windows ManagedCProj PowerToysInterop PowerToys.Interop diff --git a/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj b/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj index a89ba3f7ec..1847d53075 100644 --- a/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj +++ b/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows false win-x64;win-arm64 diff --git a/src/modules/EnvironmentVariables/EnvironmentVariables/EnvironmentVariables.csproj b/src/modules/EnvironmentVariables/EnvironmentVariables/EnvironmentVariables.csproj index 8d10c65e2c..4d544d3b65 100644 --- a/src/modules/EnvironmentVariables/EnvironmentVariables/EnvironmentVariables.csproj +++ b/src/modules/EnvironmentVariables/EnvironmentVariables/EnvironmentVariables.csproj @@ -3,12 +3,12 @@ WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 EnvironmentVariables app.manifest - win10-x64;win10-arm64 + win-x64;win-arm64 true true true @@ -34,10 +34,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/FileLocksmith/FileLocksmithLibInterop/FileLocksmithLibInterop.vcxproj b/src/modules/FileLocksmith/FileLocksmithLibInterop/FileLocksmithLibInterop.vcxproj index 6335ae919e..50ba1ec7da 100644 --- a/src/modules/FileLocksmith/FileLocksmithLibInterop/FileLocksmithLibInterop.vcxproj +++ b/src/modules/FileLocksmith/FileLocksmithLibInterop/FileLocksmithLibInterop.vcxproj @@ -31,7 +31,7 @@ Win32Proj {c604b37e-9d0e-4484-8778-e8b31b0e1b3a} FileLocksmithLibInterop - net7.0-windows + net8.0-windows ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\ PowerToys.FileLocksmithLib.Interop diff --git a/src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj b/src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj index 1adec90526..6d5ada2cef 100644 --- a/src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj +++ b/src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj @@ -5,14 +5,14 @@ PowerToys.FileLocksmith PowerToys File Locksmith WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps PowerToys.FileLocksmithUI PowerToys.FileLocksmithUI app.manifest - win10-x64;win10-arm64 + win-x64;win-arm64 true true false @@ -35,10 +35,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 1a0c71a859..800c6473ca 100644 --- a/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,11 +5,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration)\WinUI3Apps - win10-$(Platform) + win-$(Platform) true False False diff --git a/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj b/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj index 3cbcdab9ec..c4ee03077a 100644 --- a/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj +++ b/src/modules/Hosts/Hosts.Tests/Hosts.Tests.csproj @@ -2,10 +2,10 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 - win10-x64;win10-arm64 + win-x64;win-arm64 false false false diff --git a/src/modules/Hosts/Hosts/Hosts.csproj b/src/modules/Hosts/Hosts/Hosts.csproj index f884172d9a..ba13f01b00 100644 --- a/src/modules/Hosts/Hosts/Hosts.csproj +++ b/src/modules/Hosts/Hosts/Hosts.csproj @@ -3,12 +3,12 @@ WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 Hosts app.manifest - win10-x64;win10-arm64 + win-x64;win-arm64 true true None @@ -34,10 +34,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/Hosts/HostsModuleInterface/dllmain.cpp b/src/modules/Hosts/HostsModuleInterface/dllmain.cpp index e089c06975..85077c8dbe 100644 --- a/src/modules/Hosts/HostsModuleInterface/dllmain.cpp +++ b/src/modules/Hosts/HostsModuleInterface/dllmain.cpp @@ -51,9 +51,9 @@ private: HANDLE m_hProcess = nullptr; - HANDLE m_hShowEvent; + HANDLE m_hShowEvent{}; - HANDLE m_hShowAdminEvent; + HANDLE m_hShowAdminEvent{}; bool is_process_running() { diff --git a/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj b/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj index 23365eedc3..789b4e5ace 100644 --- a/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj +++ b/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj @@ -5,14 +5,14 @@ PowerToys.MeasureTool PowerToys MeasureTool WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps PowerToys.MeasureToolUI PowerToys.MeasureToolUI app.manifest x86;x64;arm64 - win10-x86;win10-x64;win10-arm64 + win-x86;win-x64;win-arm64 true true false @@ -35,10 +35,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/MouseUtils/MouseJumpUI.UnitTests/MouseJumpUI.UnitTests.csproj b/src/modules/MouseUtils/MouseJumpUI.UnitTests/MouseJumpUI.UnitTests.csproj index 701ef550a6..86100f4a8d 100644 --- a/src/modules/MouseUtils/MouseJumpUI.UnitTests/MouseJumpUI.UnitTests.csproj +++ b/src/modules/MouseUtils/MouseJumpUI.UnitTests/MouseJumpUI.UnitTests.csproj @@ -2,7 +2,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {D9C5DE64-6849-4278-91AD-9660AECF2876} diff --git a/src/modules/MouseUtils/MouseJumpUI/Helpers/LayoutHelper.cs b/src/modules/MouseUtils/MouseJumpUI/Helpers/LayoutHelper.cs index 768a6f8ddd..025bba1d6e 100644 --- a/src/modules/MouseUtils/MouseJumpUI/Helpers/LayoutHelper.cs +++ b/src/modules/MouseUtils/MouseJumpUI/Helpers/LayoutHelper.cs @@ -16,10 +16,7 @@ internal static class LayoutHelper public static LayoutInfo CalculateLayoutInfo( LayoutConfig layoutConfig) { - if (layoutConfig is null) - { - throw new ArgumentNullException(nameof(layoutConfig)); - } + ArgumentNullException.ThrowIfNull(layoutConfig); var builder = new LayoutInfo.Builder { diff --git a/src/modules/MouseUtils/MouseJumpUI/MouseJumpUI.csproj b/src/modules/MouseUtils/MouseJumpUI/MouseJumpUI.csproj index d8cbe38df9..d2ec254c04 100644 --- a/src/modules/MouseUtils/MouseJumpUI/MouseJumpUI.csproj +++ b/src/modules/MouseUtils/MouseJumpUI/MouseJumpUI.csproj @@ -17,10 +17,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 @@ -32,7 +32,7 @@ WinExe MouseJumpUI PowerToys.MouseJumpUI - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/MouseWithoutBorders/App/Class/Common.Encryption.cs b/src/modules/MouseWithoutBorders/App/Class/Common.Encryption.cs index 7a0562b845..33f5289419 100644 --- a/src/modules/MouseWithoutBorders/App/Class/Common.Encryption.cs +++ b/src/modules/MouseWithoutBorders/App/Class/Common.Encryption.cs @@ -115,7 +115,7 @@ namespace MouseWithoutBorders byte[] rv; string myKey = Common.MyKey; - if (!LegalKeyDictionary.ContainsKey(myKey)) + if (!LegalKeyDictionary.TryGetValue(myKey, out byte[] value)) { Rfc2898DeriveBytes key = new( myKey, @@ -127,7 +127,7 @@ namespace MouseWithoutBorders } else { - rv = LegalKeyDictionary[myKey]; + rv = value; } return rv; diff --git a/src/modules/MouseWithoutBorders/App/Helper/MouseWithoutBordersHelper.csproj b/src/modules/MouseWithoutBorders/App/Helper/MouseWithoutBordersHelper.csproj index af7ac9c3b3..18bf39e7e3 100644 --- a/src/modules/MouseWithoutBorders/App/Helper/MouseWithoutBordersHelper.csproj +++ b/src/modules/MouseWithoutBorders/App/Helper/MouseWithoutBordersHelper.csproj @@ -1,7 +1,7 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 WinExe @@ -19,10 +19,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/MouseWithoutBorders/App/MouseWithoutBorders.csproj b/src/modules/MouseWithoutBorders/App/MouseWithoutBorders.csproj index d84499b839..2e7a227a47 100644 --- a/src/modules/MouseWithoutBorders/App/MouseWithoutBorders.csproj +++ b/src/modules/MouseWithoutBorders/App/MouseWithoutBorders.csproj @@ -1,7 +1,7 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 WinExe @@ -19,10 +19,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/MouseWithoutBorders/App/Service/MouseWithoutBordersService.csproj b/src/modules/MouseWithoutBorders/App/Service/MouseWithoutBordersService.csproj index cd9de124a7..8a7d487fc5 100644 --- a/src/modules/MouseWithoutBorders/App/Service/MouseWithoutBordersService.csproj +++ b/src/modules/MouseWithoutBorders/App/Service/MouseWithoutBordersService.csproj @@ -1,7 +1,7 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -20,10 +20,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 TRACE;DEBUG;SHOW_ON_WINLOGON CODE_ANALYSIS CUSTOMIZE_LOGON_SCREEN diff --git a/src/modules/PowerOCR/PowerOCR/Helpers/WrappingStream.cs b/src/modules/PowerOCR/PowerOCR/Helpers/WrappingStream.cs index fc49112ef6..5b952d1f73 100644 --- a/src/modules/PowerOCR/PowerOCR/Helpers/WrappingStream.cs +++ b/src/modules/PowerOCR/PowerOCR/Helpers/WrappingStream.cs @@ -220,9 +220,6 @@ public class WrappingStream : Stream private void ThrowIfDisposed() { // throws an ObjectDisposedException if this object has been disposed - if (_streamBase == null) - { - throw new ObjectDisposedException(GetType().Name); - } + ObjectDisposedException.ThrowIf(_streamBase == null, this); } } diff --git a/src/modules/PowerOCR/PowerOCR/PowerOCR.csproj b/src/modules/PowerOCR/PowerOCR/PowerOCR.csproj index 4116b0889c..10887afce7 100644 --- a/src/modules/PowerOCR/PowerOCR/PowerOCR.csproj +++ b/src/modules/PowerOCR/PowerOCR/PowerOCR.csproj @@ -15,10 +15,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 @@ -28,7 +28,7 @@ PowerOCRLogo.png PowerOCR PowerToys.PowerOCR - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {2150E333-8FDC-42A3-9474-1A3956D46DE8} diff --git a/src/modules/awake/Awake/Awake.csproj b/src/modules/awake/Awake/Awake.csproj index 58576db33c..9f09482fdb 100644 --- a/src/modules/awake/Awake/Awake.csproj +++ b/src/modules/awake/Awake/Awake.csproj @@ -2,7 +2,7 @@ WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 win-x64;win-arm64 @@ -24,10 +24,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/awake/Awake/Core/ExtensionMethods.cs b/src/modules/awake/Awake/Core/ExtensionMethods.cs index 00d07fe799..d669791b3f 100644 --- a/src/modules/awake/Awake/Core/ExtensionMethods.cs +++ b/src/modules/awake/Awake/Core/ExtensionMethods.cs @@ -11,15 +11,9 @@ namespace Awake.Core { public static void AddRange(this ICollection target, IEnumerable source) { - if (target == null) - { - throw new ArgumentNullException(nameof(target)); - } + ArgumentNullException.ThrowIfNull(target); - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } + ArgumentNullException.ThrowIfNull(source); foreach (var element in source) { diff --git a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj index ed1926d3ae..41516fb3f3 100644 --- a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj +++ b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj @@ -14,10 +14,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 @@ -25,7 +25,7 @@ WinExe ColorPicker PowerToys.ColorPickerUI - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs b/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs index 599890bdac..7c9e87f092 100644 --- a/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs +++ b/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs @@ -28,10 +28,7 @@ namespace ColorPicker.Common public void AddRange(IEnumerable list) { - if (list == null) - { - throw new ArgumentNullException(nameof(list)); - } + ArgumentNullException.ThrowIfNull(list); _suppressNotification = true; diff --git a/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj b/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj index e9cf5ee42a..009be36014 100644 --- a/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj +++ b/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj @@ -2,7 +2,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {090CD7B7-3B0C-4D1D-BC98-83EB5D799BC1} diff --git a/src/modules/fancyzones/UnitTests-FancyZonesEditor/UnitTests-FancyZonesEditor.csproj b/src/modules/fancyzones/UnitTests-FancyZonesEditor/UnitTests-FancyZonesEditor.csproj index a146ad62b2..8d1972207f 100644 --- a/src/modules/fancyzones/UnitTests-FancyZonesEditor/UnitTests-FancyZonesEditor.csproj +++ b/src/modules/fancyzones/UnitTests-FancyZonesEditor/UnitTests-FancyZonesEditor.csproj @@ -1,7 +1,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 enable diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj index 6c876344dd..dae02ff5ba 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj +++ b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj @@ -17,15 +17,15 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 {5CCC8468-DEC8-4D36-99D4-5C891BEBD481} - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs index 54311b4b03..f8b783768a 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutHotkeysModel.cs @@ -43,12 +43,12 @@ namespace FancyZonesEditor.Models public bool SelectKey(string key, string uuid) { - if (!SelectedKeys.ContainsKey(key)) + if (!SelectedKeys.TryGetValue(key, out string value)) { return false; } - if (SelectedKeys[key] == uuid) + if (value == uuid) { return true; } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand.cs index ecb0d0f285..d24f7cdfd3 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand.cs @@ -20,10 +20,7 @@ namespace FancyZonesEditor.Utils public RelayCommand(Action execute, Predicate canExecute) { - if (execute == null) - { - throw new ArgumentNullException(nameof(execute)); - } + ArgumentNullException.ThrowIfNull(execute); _execute = execute; _canExecute = canExecute; diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand`1.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand`1.cs index 3575f3546b..022e014945 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand`1.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/RelayCommand`1.cs @@ -20,10 +20,7 @@ namespace FancyZonesEditor.Utils public RelayCommand(Action execute, Predicate canExecute) { - if (execute == null) - { - throw new ArgumentNullException(nameof(execute)); - } + ArgumentNullException.ThrowIfNull(execute); _execute = execute; _canExecute = canExecute; diff --git a/src/modules/imageresizer/tests/ImageResizerUITest.csproj b/src/modules/imageresizer/tests/ImageResizerUITest.csproj index 341bd6e8af..cbcfa6aed7 100644 --- a/src/modules/imageresizer/tests/ImageResizerUITest.csproj +++ b/src/modules/imageresizer/tests/ImageResizerUITest.csproj @@ -2,7 +2,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8} diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj index 8aef549971..8c1af92376 100644 --- a/src/modules/imageresizer/ui/ImageResizerUI.csproj +++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj @@ -13,10 +13,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 @@ -24,7 +24,7 @@ WinExe ImageResizer PowerToys.ImageResizer - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.csproj b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.csproj index 2dde83d9ed..0821c7fd2c 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.csproj +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest/Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.csproj @@ -1,7 +1,7 @@ - net7.0-windows + net8.0-windows false diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Community.PowerToys.Run.Plugin.UnitConverter.csproj b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Community.PowerToys.Run.Plugin.UnitConverter.csproj index 80e0ae406d..9d81ee857e 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Community.PowerToys.Run.Plugin.UnitConverter.csproj +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Community.PowerToys.Run.Plugin.UnitConverter.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {BB23A474-5058-4F75-8FA3-5FE3DE53CDF4} Properties Community.PowerToys.Run.Plugin.UnitConverter diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Main.cs b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Main.cs index 3e4b9285ea..ce2f4cfe5e 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Main.cs +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Main.cs @@ -29,10 +29,7 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter public void Init(PluginInitContext context) { - if (context == null) - { - throw new ArgumentNullException(paramName: nameof(context)); - } + ArgumentNullException.ThrowIfNull(context); _context = context; _context.API.ThemeChanged += OnThemeChanged; @@ -41,10 +38,7 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter public List Query(Query query) { - if (query == null) - { - throw new ArgumentNullException(paramName: nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); // Parse ConvertModel convertModel = InputInterpreter.Parse(query); diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Community.PowerToys.Run.Plugin.VSCodeWorkspaces.csproj b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Community.PowerToys.Run.Plugin.VSCodeWorkspaces.csproj index a7cfc70a95..52a1b4b1e0 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Community.PowerToys.Run.Plugin.VSCodeWorkspaces.csproj +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Community.PowerToys.Run.Plugin.VSCodeWorkspaces.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {4D971245-7A70-41D5-BAA0-DDB5684CAF51} Properties Community.PowerToys.Run.Plugin.VSCodeWorkspaces diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.csproj b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.csproj index ba684821bd..3e025e582b 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests/Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows enable false diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Community.PowerToys.Run.Plugin.ValueGenerator.csproj b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Community.PowerToys.Run.Plugin.ValueGenerator.csproj index 6426a71a13..fde3e7f4ab 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Community.PowerToys.Run.Plugin.ValueGenerator.csproj +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Community.PowerToys.Run.Plugin.ValueGenerator.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {D095BE44-1F2E-463E-A494-121892A75EA2} true $(Version).0 diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Main.cs b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Main.cs index 96864d1de7..36536da303 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Main.cs +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Main.cs @@ -87,10 +87,7 @@ namespace Community.PowerToys.Run.Plugin.ValueGenerator public List Query(Query query) { - if (query == null) - { - throw new ArgumentNullException(paramName: nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); var results = new List(); try diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Community.PowerToys.Run.Plugin.WebSearch.csproj b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Community.PowerToys.Run.Plugin.WebSearch.csproj index 42880b5487..f5740c38dd 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Community.PowerToys.Run.Plugin.WebSearch.csproj +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Community.PowerToys.Run.Plugin.WebSearch.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {9F94B303-5E21-4364-9362-64426F8DB932} Properties Community.PowerToys.Run.Plugin.WebSearch diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs index dd83014518..669f20d63c 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/Main.cs @@ -55,10 +55,7 @@ namespace Community.PowerToys.Run.Plugin.WebSearch public List Query(Query query) { - if (query is null) - { - throw new ArgumentNullException(nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); var results = new List(); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj index e7733c997e..ef3600707f 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/Microsoft.Plugin.Folder.UnitTests.csproj @@ -1,7 +1,7 @@ - net7.0-windows + net8.0-windows false Microsoft.Plugin.Folder.UnitTests true diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/EnvironmentVariableProcessor.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/EnvironmentVariableProcessor.cs index 58a5be8c76..5107cacaf1 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/EnvironmentVariableProcessor.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/EnvironmentVariableProcessor.cs @@ -23,10 +23,7 @@ namespace Microsoft.Plugin.Folder public IEnumerable Results(string actionKeyword, string search) { - if (search == null) - { - throw new ArgumentNullException(nameof(search)); - } + ArgumentNullException.ThrowIfNull(search); if (!_environmentHelper.IsEnvironmentVariable(search)) { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Main.cs index 7911cc90c7..84d52ebc45 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Main.cs @@ -58,10 +58,7 @@ namespace Microsoft.Plugin.Folder public List Query(Query query) { - if (query == null) - { - throw new ArgumentNullException(paramName: nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); var expandedName = FolderHelper.Expand(query.Search); @@ -82,10 +79,7 @@ namespace Microsoft.Plugin.Folder public static IEnumerable GetFolderPluginResults(Query query) { - if (query == null) - { - throw new ArgumentNullException(paramName: nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); var expandedName = FolderHelper.Expand(query.Search); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj index 30f41c27da..384b278b2d 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} Properties Microsoft.Plugin.Folder diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/EnvironmentHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/EnvironmentHelper.cs index 795c710cd2..c99890c65a 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/EnvironmentHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/EnvironmentHelper.cs @@ -11,10 +11,7 @@ namespace Microsoft.Plugin.Folder.Sources { public bool IsEnvironmentVariable(string search) { - if (search == null) - { - throw new ArgumentNullException(paramName: nameof(search)); - } + ArgumentNullException.ThrowIfNull(search); return search.StartsWith('%'); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs index 3035801b83..afaa1b488e 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs @@ -23,10 +23,7 @@ namespace Microsoft.Plugin.Folder.Sources public IEnumerable GetUserFolderResults(string query) { - if (query == null) - { - throw new ArgumentNullException(paramName: nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); // Using OrdinalIgnoreCase since this is internal return _folderLinks.FolderLinks() @@ -35,10 +32,7 @@ namespace Microsoft.Plugin.Folder.Sources public bool IsDriveOrSharedFolder(string search) { - if (search == null) - { - throw new ArgumentNullException(nameof(search)); - } + ArgumentNullException.ThrowIfNull(search); // Using Ordinal this is internal and we're comparing symbols if (search.StartsWith(@"\\", StringComparison.Ordinal)) @@ -79,10 +73,7 @@ namespace Microsoft.Plugin.Folder.Sources public static string Expand(string search) { - if (search == null) - { - throw new ArgumentNullException(nameof(search)); - } + ArgumentNullException.ThrowIfNull(search); search = Environment.ExpandEnvironmentVariables(search); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryEnvironmentVariable.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryEnvironmentVariable.cs index 49c0f1d29a..bf4aac1113 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryEnvironmentVariable.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryEnvironmentVariable.cs @@ -24,10 +24,7 @@ namespace Microsoft.Plugin.Folder.Sources public IEnumerable Query(string querySearch) { - if (querySearch == null) - { - throw new ArgumentNullException(nameof(querySearch)); - } + ArgumentNullException.ThrowIfNull(querySearch); return GetEnvironmentVariables(querySearch) .OrderBy(v => v.Title) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs index e576497259..c4cf6fbb1d 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Buffers; using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; @@ -15,6 +16,7 @@ namespace Microsoft.Plugin.Folder.Sources { public class QueryInternalDirectory : IQueryInternalDirectory { + private static readonly SearchValues PathChars = SearchValues.Create("\\/"); private readonly FolderSettings _settings; private readonly IQueryFileSystemInfo _queryFileSystemInfo; private readonly IDirectory _directory; @@ -51,7 +53,7 @@ namespace Microsoft.Plugin.Folder.Sources { // if folder doesn't exist, we want to take the last part and use it afterwards to help the user // find the right folder. - int index = search.LastIndexOfAny(new char[] { '\\', '/' }); + int index = search.AsSpan().LastIndexOfAny(PathChars); // No slashes found, so probably not a folder if (index <= 0 || index >= search.Length - 1) @@ -84,10 +86,7 @@ namespace Microsoft.Plugin.Folder.Sources public IEnumerable Query(string search) { - if (search == null) - { - throw new ArgumentNullException(nameof(search)); - } + ArgumentNullException.ThrowIfNull(search); var processed = Process(search); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs index 7a1d75f3d6..364f7faa34 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs @@ -14,20 +14,14 @@ namespace Microsoft.Plugin.Folder.Sources { public bool Execute(string sanitizedPath, IPublicAPI contextApi) { - if (contextApi == null) - { - throw new ArgumentNullException(nameof(contextApi)); - } + ArgumentNullException.ThrowIfNull(contextApi); return OpenFileOrFolder(sanitizedPath, contextApi); } public bool ExecuteSanitized(string search, IPublicAPI contextApi) { - if (contextApi == null) - { - throw new ArgumentNullException(nameof(contextApi)); - } + ArgumentNullException.ThrowIfNull(contextApi); return Execute(SanitizedPath(search), contextApi); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj index df67c0c565..bf3b3cb1ee 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {F8B870EB-D5F5-45BA-9CF7-A5C459818820} Properties Microsoft.Plugin.Indexer diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs index 245ef1baae..87efea3af9 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs @@ -25,10 +25,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper public List ExecuteQuery(ISearchQueryHelper queryHelper, string keyword) { - if (queryHelper == null) - { - throw new ArgumentNullException(paramName: nameof(queryHelper)); - } + ArgumentNullException.ThrowIfNull(queryHelper); List results = new List(); @@ -70,15 +67,9 @@ namespace Microsoft.Plugin.Indexer.SearchHelper public static void ModifyQueryHelper(ref ISearchQueryHelper queryHelper, string pattern) { - if (pattern == null) - { - throw new ArgumentNullException(paramName: nameof(pattern)); - } + ArgumentNullException.ThrowIfNull(pattern); - if (queryHelper == null) - { - throw new ArgumentNullException(paramName: nameof(queryHelper)); - } + ArgumentNullException.ThrowIfNull(queryHelper); // convert file pattern if it is not '*'. Don't create restriction for '*' as it includes all files. if (pattern != "*") @@ -101,10 +92,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper public static void InitQueryHelper(out ISearchQueryHelper queryHelper, ISearchManager manager, int maxCount, bool displayHiddenFiles) { - if (manager == null) - { - throw new ArgumentNullException(nameof(manager)); - } + ArgumentNullException.ThrowIfNull(manager); // SystemIndex catalog is the default catalog in Windows ISearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex"); @@ -136,10 +124,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper public IEnumerable Search(string keyword, ISearchManager manager, string pattern = "*", int maxCount = 30) { - if (manager == null) - { - throw new ArgumentNullException(nameof(manager)); - } + ArgumentNullException.ThrowIfNull(manager); ISearchQueryHelper queryHelper; InitQueryHelper(out queryHelper, manager, maxCount, DisplayHiddenFiles); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Microsoft.Plugin.Program.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Microsoft.Plugin.Program.UnitTests.csproj index 8d232b0745..8e0213f983 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Microsoft.Plugin.Program.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Microsoft.Plugin.Program.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 false diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs index 94416f32a1..ebd6d0d3db 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs @@ -157,10 +157,7 @@ namespace Microsoft.Plugin.Program public List LoadContextMenus(Result selectedResult) { - if (selectedResult == null) - { - throw new ArgumentNullException(nameof(selectedResult)); - } + ArgumentNullException.ThrowIfNull(selectedResult); var menuOptions = new List(); if (selectedResult.ContextData is IProgram program) @@ -175,15 +172,9 @@ namespace Microsoft.Plugin.Program { try { - if (runProcess == null) - { - throw new ArgumentNullException(nameof(runProcess)); - } + ArgumentNullException.ThrowIfNull(runProcess); - if (info == null) - { - throw new ArgumentNullException(nameof(info)); - } + ArgumentNullException.ThrowIfNull(info); runProcess(info); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Microsoft.Plugin.Program.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Microsoft.Plugin.Program.csproj index ceec7703b8..c334a5876b 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Microsoft.Plugin.Program.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Microsoft.Plugin.Program.csproj @@ -2,7 +2,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {FDB3555B-58EF-4AE6-B5F1-904719637AB4} diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackageWrapper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackageWrapper.cs index 260388cc43..88a06beeb0 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackageWrapper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackageWrapper.cs @@ -44,10 +44,7 @@ namespace Microsoft.Plugin.Program.Programs public static PackageWrapper GetWrapperFromPackage(Package package) { - if (package == null) - { - throw new ArgumentNullException(nameof(package)); - } + ArgumentNullException.ThrowIfNull(package); string path; try diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs index 22b8326c68..0c62af93de 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs @@ -47,10 +47,7 @@ namespace Microsoft.Plugin.Program.Programs public UWP(IPackage package) { - if (package == null) - { - throw new ArgumentNullException(nameof(package)); - } + ArgumentNullException.ThrowIfNull(package); Name = package.Name; FullName = package.FullName; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs index 572511290f..f46295ec50 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs @@ -91,10 +91,7 @@ namespace Microsoft.Plugin.Program.Programs public Result Result(string query, string queryArguments, IPublicAPI api) { - if (api == null) - { - throw new ArgumentNullException(nameof(api)); - } + ArgumentNullException.ThrowIfNull(api); var score = Score(query); if (score <= 0) @@ -130,10 +127,7 @@ namespace Microsoft.Plugin.Program.Programs public List ContextMenus(string queryArguments, IPublicAPI api) { - if (api == null) - { - throw new ArgumentNullException(nameof(api)); - } + ArgumentNullException.ThrowIfNull(api); var contextMenus = new List(); @@ -229,10 +223,7 @@ namespace Microsoft.Plugin.Program.Programs public UWPApplication(IAppxManifestApplication manifestApp, UWP package) { - if (manifestApp == null) - { - throw new ArgumentNullException(nameof(manifestApp)); - } + ArgumentNullException.ThrowIfNull(manifestApp); var hr = manifestApp.GetAppUserModelId(out var tmpUserModelId); UserModelId = AppxPackageHelper.CheckHRAndReturnOrThrow(hr, tmpUserModelId); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs index c55a73000d..6ee8293ed7 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs @@ -205,10 +205,7 @@ namespace Microsoft.Plugin.Program.Programs public Result Result(string query, string queryArguments, IPublicAPI api) { - if (api == null) - { - throw new ArgumentNullException(nameof(api)); - } + ArgumentNullException.ThrowIfNull(api); var score = Score(query); if (score <= 0) @@ -274,10 +271,7 @@ namespace Microsoft.Plugin.Program.Programs public List ContextMenus(string queryArguments, IPublicAPI api) { - if (api == null) - { - throw new ArgumentNullException(nameof(api)); - } + ArgumentNullException.ThrowIfNull(api); var contextMenus = new List(); @@ -605,10 +599,7 @@ namespace Microsoft.Plugin.Program.Programs // Function to get the application type, given the path to the application public static ApplicationType GetAppTypeFromPath(string path) { - if (path == null) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentNullException.ThrowIfNull(path); string extension = Extension(path); @@ -640,10 +631,7 @@ namespace Microsoft.Plugin.Program.Programs // Function to get the Win32 application, given the path to the application public static Win32Program GetAppFromPath(string path) { - if (path == null) - { - throw new ArgumentNullException(nameof(path)); - } + ArgumentNullException.ThrowIfNull(path); Win32Program app; switch (GetAppTypeFromPath(path)) @@ -985,10 +973,7 @@ namespace Microsoft.Plugin.Program.Programs public static IList All(ProgramPluginSettings settings) { - if (settings == null) - { - throw new ArgumentNullException(nameof(settings)); - } + ArgumentNullException.ThrowIfNull(settings); try { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs index 9355774e6b..347fca212c 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs @@ -14,10 +14,7 @@ namespace Microsoft.Plugin.Program.Storage // On the first occurrence of a different file path, the existing app path is to be returned without removing any more elements from the queue. public static async Task GetAppPathFromQueueAsync(ConcurrentQueue eventHandlingQueue, int dequeueDelay) { - if (eventHandlingQueue == null) - { - throw new ArgumentNullException(nameof(eventHandlingQueue)); - } + ArgumentNullException.ThrowIfNull(eventHandlingQueue); string previousAppPath = string.Empty; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs index d9057a57be..584a9a4f7a 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs @@ -85,10 +85,7 @@ namespace Microsoft.Plugin.Shell public List Query(Query query) { - if (query == null) - { - throw new ArgumentNullException(nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); List results = new List(); string cmd = query.Search; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Microsoft.Plugin.Shell.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Microsoft.Plugin.Shell.csproj index 70efa994a4..b8218ad90f 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Microsoft.Plugin.Shell.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Microsoft.Plugin.Shell.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} Properties Microsoft.Plugin.Shell diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/Microsoft.Plugin.Uri.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/Microsoft.Plugin.Uri.UnitTests.csproj index 7581eeb4fc..89cae7cc22 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/Microsoft.Plugin.Uri.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/Microsoft.Plugin.Uri.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows false Microsoft.Plugin.Uri.UnitTests true diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Microsoft.Plugin.Uri.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Microsoft.Plugin.Uri.csproj index a78f5ab4e6..cff4db6b21 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Microsoft.Plugin.Uri.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Microsoft.Plugin.Uri.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {03276a39-d4e9-417c-8ffd-200b0ee5e871} Properties Microsoft.Plugin.Uri diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker.UnitTests/Microsoft.Plugin.WindowWalker.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker.UnitTests/Microsoft.Plugin.WindowWalker.UnitTests.csproj index 9514bf32bf..865fcc1bff 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker.UnitTests/Microsoft.Plugin.WindowWalker.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker.UnitTests/Microsoft.Plugin.WindowWalker.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows false Microsoft.Plugin.WindowWalker.UnitTests diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs index 4fdcf44256..35d8981262 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs @@ -26,15 +26,9 @@ namespace Microsoft.Plugin.WindowWalker.Components /// returns the index location of each of the letters of the matches internal static List FindBestFuzzyMatch(string text, string searchText) { - if (searchText == null) - { - throw new ArgumentNullException(nameof(searchText)); - } + ArgumentNullException.ThrowIfNull(searchText); - if (text == null) - { - throw new ArgumentNullException(nameof(text)); - } + ArgumentNullException.ThrowIfNull(text); // Using CurrentCulture since this is user facing searchText = searchText.ToLower(CultureInfo.CurrentCulture); @@ -86,10 +80,7 @@ namespace Microsoft.Plugin.WindowWalker.Components /// a list of the possible combinations that match the search text internal static List> GetAllMatchIndexes(bool[,] matches) { - if (matches == null) - { - throw new ArgumentNullException(nameof(matches)); - } + ArgumentNullException.ThrowIfNull(matches); List> results = new List>(); @@ -127,10 +118,7 @@ namespace Microsoft.Plugin.WindowWalker.Components /// an integer representing the score internal static int CalculateScoreForMatches(List matches) { - if (matches == null) - { - throw new ArgumentNullException(nameof(matches)); - } + ArgumentNullException.ThrowIfNull(matches); var score = 0; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs index cb660fe26b..2319816658 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs @@ -35,10 +35,7 @@ namespace Microsoft.Plugin.WindowWalker public List Query(Query query) { - if (query == null) - { - throw new ArgumentNullException(nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); _cancellationTokenSource?.Cancel(); _cancellationTokenSource?.Dispose(); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj index 5e732ba94e..cbb35f51c2 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {74F1B9ED-F59C-4FE7-B473-7B453E30837E} Properties Microsoft.Plugin.WindowWalker diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.csproj index b7617a8f6f..37d1397bbc 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest/Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.csproj @@ -1,7 +1,7 @@ - net7.0-windows + net8.0-windows false Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests true diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Microsoft.PowerToys.Run.Plugin.Calculator.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Microsoft.PowerToys.Run.Plugin.Calculator.csproj index 07124150c5..62b691a493 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Microsoft.PowerToys.Run.Plugin.Calculator.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Microsoft.PowerToys.Run.Plugin.Calculator.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {59BD9891-3837-438A-958D-ADC7F91F6F7E} Properties Microsoft.PowerToys.Run.Plugin.Calculator diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs index 12eb23b201..9278f10912 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/NumberTranslator.cs @@ -36,15 +36,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator /// Number translator for target culture public static NumberTranslator Create(CultureInfo sourceCulture, CultureInfo targetCulture) { - if (sourceCulture == null) - { - throw new ArgumentNullException(paramName: nameof(sourceCulture)); - } + ArgumentNullException.ThrowIfNull(sourceCulture); - if (targetCulture == null) - { - throw new ArgumentNullException(paramName: nameof(targetCulture)); - } + ArgumentNullException.ThrowIfNull(targetCulture); return new NumberTranslator(sourceCulture, targetCulture); } diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/Microsoft.PowerToys.Run.Plugin.History.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/Microsoft.PowerToys.Run.Plugin.History.csproj index 417cc9033d..31ba17e106 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/Microsoft.PowerToys.Run.Plugin.History.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/Microsoft.PowerToys.Run.Plugin.History.csproj @@ -2,7 +2,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {212AD910-8488-4036-BE20-326931B75FB2} diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/Microsoft.PowerToys.Run.Plugin.OneNote.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/Microsoft.PowerToys.Run.Plugin.OneNote.csproj index ea27545bec..06c24f5007 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/Microsoft.PowerToys.Run.Plugin.OneNote.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/Microsoft.PowerToys.Run.Plugin.OneNote.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows Microsoft.PowerToys.Run.Plugin.OneNote Microsoft.PowerToys.Run.Plugin.OneNote enable diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Microsoft.PowerToys.Run.Plugin.PowerToys.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Microsoft.PowerToys.Run.Plugin.PowerToys.csproj index df84c6d95b..f56985e9ff 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Microsoft.PowerToys.Run.Plugin.PowerToys.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Microsoft.PowerToys.Run.Plugin.PowerToys.csproj @@ -3,7 +3,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 Microsoft.PowerToys.Run.Plugin.PowerToys diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.csproj index dbe62e3a3e..ce337db1a2 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows enable false diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Microsoft.PowerToys.Run.Plugin.Registry.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Microsoft.PowerToys.Run.Plugin.Registry.csproj index f259ceab78..6a95fe6800 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Microsoft.PowerToys.Run.Plugin.Registry.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Microsoft.PowerToys.Run.Plugin.Registry.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows Microsoft.PowerToys.Run.Plugin.Registry Microsoft.PowerToys.Run.Plugin.Registry $(Version).0 diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Helpers/ServiceHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Helpers/ServiceHelper.cs index 0f04f0ccd9..5418503cc8 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Helpers/ServiceHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Helpers/ServiceHelper.cs @@ -80,15 +80,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Service.Helpers public static void ChangeStatus(ServiceResult serviceResult, Action action, IPublicAPI contextAPI) { - if (serviceResult == null) - { - throw new ArgumentNullException(nameof(serviceResult)); - } + ArgumentNullException.ThrowIfNull(serviceResult); - if (contextAPI == null) - { - throw new ArgumentNullException(nameof(contextAPI)); - } + ArgumentNullException.ThrowIfNull(contextAPI); try { @@ -141,10 +135,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Service.Helpers private static string GetResultSubTitle(ServiceController serviceController) { - if (serviceController == null) - { - throw new ArgumentNullException(nameof(serviceController)); - } + ArgumentNullException.ThrowIfNull(serviceController); return $"{Resources.wox_plugin_service_status}: {GetLocalizedStatus(serviceController.Status)} - {Resources.wox_plugin_service_startup}: {GetLocalizedStartType(serviceController.StartType, serviceController.ServiceName)} - {Resources.wox_plugin_service_name}: {serviceController.ServiceName}"; } diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Microsoft.PowerToys.Run.Plugin.Service.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Microsoft.PowerToys.Run.Plugin.Service.csproj index 8db116c306..1e22a25ae2 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Microsoft.PowerToys.Run.Plugin.Service.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Microsoft.PowerToys.Run.Plugin.Service.csproj @@ -3,7 +3,7 @@ - net7.0-windows + net8.0-windows Microsoft.PowerToys.Run.Plugin.Service Microsoft.PowerToys.Run.Plugin.Service $(Version).0 diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/ServiceResult.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/ServiceResult.cs index 2f5d0bd34d..e7dcb54534 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/ServiceResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/ServiceResult.cs @@ -19,10 +19,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Service public ServiceResult(ServiceController serviceController) { - if (serviceController == null) - { - throw new ArgumentNullException(nameof(serviceController)); - } + ArgumentNullException.ThrowIfNull(serviceController); ServiceName = serviceController.ServiceName; DisplayName = serviceController.DisplayName; diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/Microsoft.PowerToys.Run.Plugin.System.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/Microsoft.PowerToys.Run.Plugin.System.UnitTests.csproj index 64a2fa7d09..b8f7d30cca 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/Microsoft.PowerToys.Run.Plugin.System.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/Microsoft.PowerToys.Run.Plugin.System.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows false Microsoft.PowerToys.Run.Plugin.System.UnitTests diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Microsoft.PowerToys.Run.Plugin.System.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Microsoft.PowerToys.Run.Plugin.System.csproj index f58a67e29b..26b17adf3c 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Microsoft.PowerToys.Run.Plugin.System.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Microsoft.PowerToys.Run.Plugin.System.csproj @@ -3,7 +3,7 @@ Library - net7.0-windows + net8.0-windows Properties Microsoft.PowerToys.Run.Plugin.System Microsoft.PowerToys.Run.Plugin.System diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.csproj index e8d5351386..289a84195e 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests/Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows false Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs index ba33485848..cc0a3dc100 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs @@ -65,10 +65,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate public List Query(Query query) { - if (query == null) - { - throw new ArgumentNullException(paramName: nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); return SearchController.ExecuteSearch(query, IconTheme); } diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Microsoft.PowerToys.Run.Plugin.TimeDate.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Microsoft.PowerToys.Run.Plugin.TimeDate.csproj index 264ed425d0..e6b18cf4a9 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Microsoft.PowerToys.Run.Plugin.TimeDate.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Microsoft.PowerToys.Run.Plugin.TimeDate.csproj @@ -3,7 +3,7 @@ Library - net7.0-windows + net8.0-windows Properties Microsoft.PowerToys.Run.Plugin.TimeDate Microsoft.PowerToys.Run.Plugin.TimeDate diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj index d441af6c1c..b463d5d77e 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {5043CECE-E6A7-4867-9CBE-02D27D83747A} Properties Microsoft.PowerToys.Run.Plugin.WindowsSettings diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests/Microsoft.Plugin.WindowsTerminal.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests/Microsoft.Plugin.WindowsTerminal.UnitTests.csproj index c3ddb38751..3e896d8eae 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests/Microsoft.Plugin.WindowsTerminal.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests/Microsoft.Plugin.WindowsTerminal.UnitTests.csproj @@ -1,7 +1,7 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Main.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Main.cs index 9c1a5cb454..dce70b4996 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Main.cs @@ -203,12 +203,13 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsTerminal { var aumid = terminal.AppUserModelId; - if (!_logoCache.ContainsKey(aumid)) + if (!_logoCache.TryGetValue(aumid, out BitmapImage value)) { - _logoCache.Add(aumid, terminal.GetLogo()); + value = terminal.GetLogo(); + _logoCache.Add(aumid, value); } - return _logoCache[aumid]; + return value; } } } diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.csproj index 64492e18e8..3728ab8e30 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.csproj @@ -3,7 +3,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 Microsoft.PowerToys.Run.Plugin.WindowsTerminal diff --git a/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj b/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj index fd6a5e4176..6abe925f10 100644 --- a/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj +++ b/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows $(Version).0 diff --git a/src/modules/launcher/PowerLauncher/Helper/DragDataObject.cs b/src/modules/launcher/PowerLauncher/Helper/DragDataObject.cs index 2e818cda62..ff3843ef39 100644 --- a/src/modules/launcher/PowerLauncher/Helper/DragDataObject.cs +++ b/src/modules/launcher/PowerLauncher/Helper/DragDataObject.cs @@ -25,10 +25,7 @@ namespace PowerLauncher.Helper public static void SetDragImage(this IDataObject dataObject, IntPtr hBitmap, int width, int height) { - if (dataObject == null) - { - throw new ArgumentNullException(nameof(dataObject)); - } + ArgumentNullException.ThrowIfNull(dataObject); IDragSourceHelper dragDropHelper = (IDragSourceHelper)new DragDropHelper(); ShDragImage dragImage = new ShDragImage diff --git a/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs b/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs index fd9a8e2ef6..61ea41c496 100644 --- a/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs +++ b/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs @@ -50,9 +50,9 @@ namespace PowerLauncher.Helper string pVarKey = (string)pVar.Key; string pVarValue = (string)pVar.Value; - if (machineAndUserVars.ContainsKey(pVarKey)) + if (machineAndUserVars.TryGetValue(pVarKey, out string value)) { - if (machineAndUserVars[pVarKey] != pVarValue) + if (value != pVarValue) { // Variable value for this process differs form merged machine/user value. _protectedProcessVariables.Add(pVarKey); diff --git a/src/modules/launcher/PowerLauncher/Helper/FontHelper.cs b/src/modules/launcher/PowerLauncher/Helper/FontHelper.cs index 2da591b3fa..8f4c3719e4 100644 --- a/src/modules/launcher/PowerLauncher/Helper/FontHelper.cs +++ b/src/modules/launcher/PowerLauncher/Helper/FontHelper.cs @@ -75,10 +75,7 @@ namespace PowerLauncher.Helper public static FamilyTypeface ChooseRegularFamilyTypeface(this FontFamily family) { - if (family == null) - { - throw new ArgumentNullException(nameof(family)); - } + ArgumentNullException.ThrowIfNull(family); return family.FamilyTypefaces.OrderBy(o => { @@ -90,10 +87,7 @@ namespace PowerLauncher.Helper public static FamilyTypeface ConvertFromInvariantStringsOrNormal(this FontFamily family, string style, string weight, string stretch) { - if (family == null) - { - throw new ArgumentNullException(nameof(family)); - } + ArgumentNullException.ThrowIfNull(family); var styleObj = GetFontStyleFromInvariantStringOrNormal(style); var weightObj = GetFontWeightFromInvariantStringOrNormal(weight); diff --git a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs index 9a73221f04..02963031ca 100644 --- a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs +++ b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs @@ -188,10 +188,7 @@ namespace PowerLauncher.Plugin public static List QueryForPlugin(PluginPair pair, Query query, bool delayedExecution = false) { - if (pair == null) - { - throw new ArgumentNullException(nameof(pair)); - } + ArgumentNullException.ThrowIfNull(pair); if (!pair.IsPluginInitialized) { @@ -272,15 +269,9 @@ namespace PowerLauncher.Plugin public static void UpdatePluginMetadata(List results, PluginMetadata metadata, Query query) { - if (results == null) - { - throw new ArgumentNullException(nameof(results)); - } + ArgumentNullException.ThrowIfNull(results); - if (metadata == null) - { - throw new ArgumentNullException(nameof(metadata)); - } + ArgumentNullException.ThrowIfNull(metadata); foreach (var r in results) { diff --git a/src/modules/launcher/PowerLauncher/Plugin/QueryBuilder.cs b/src/modules/launcher/PowerLauncher/Plugin/QueryBuilder.cs index 5a98fb36b1..d2dd53df0e 100644 --- a/src/modules/launcher/PowerLauncher/Plugin/QueryBuilder.cs +++ b/src/modules/launcher/PowerLauncher/Plugin/QueryBuilder.cs @@ -12,10 +12,7 @@ namespace PowerLauncher.Plugin { public static Dictionary Build(string text) { - if (text == null) - { - throw new ArgumentNullException(nameof(text)); - } + ArgumentNullException.ThrowIfNull(text); text = text.Trim(); int longestActionKeywordLength = 0; diff --git a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj index 6aef6a34c4..471afe1198 100644 --- a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj +++ b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj @@ -3,7 +3,7 @@ PowerToys.Run WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -26,10 +26,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml index c0d655d21f..74eeb2f948 100644 --- a/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) diff --git a/src/modules/launcher/PowerLauncher/SettingsReader.cs b/src/modules/launcher/PowerLauncher/SettingsReader.cs index a4fed3d904..610dc6c1c3 100644 --- a/src/modules/launcher/PowerLauncher/SettingsReader.cs +++ b/src/modules/launcher/PowerLauncher/SettingsReader.cs @@ -262,15 +262,15 @@ namespace PowerLauncher var defaultPlugins = GetDefaultPluginsSettings().ToDictionary(x => x.Id); foreach (PowerLauncherPluginSettings plugin in settings.Plugins) { - if (defaultPlugins.ContainsKey(plugin.Id)) + if (defaultPlugins.TryGetValue(plugin.Id, out PowerLauncherPluginSettings value)) { - var additionalOptions = CombineAdditionalOptions(defaultPlugins[plugin.Id].AdditionalOptions, plugin.AdditionalOptions); + var additionalOptions = CombineAdditionalOptions(value.AdditionalOptions, plugin.AdditionalOptions); var enabledPolicyState = GPOWrapper.GetRunPluginEnabledValue(plugin.Id); - plugin.Name = defaultPlugins[plugin.Id].Name; - plugin.Description = defaultPlugins[plugin.Id].Description; - plugin.Author = defaultPlugins[plugin.Id].Author; - plugin.IconPathDark = defaultPlugins[plugin.Id].IconPathDark; - plugin.IconPathLight = defaultPlugins[plugin.Id].IconPathLight; + plugin.Name = value.Name; + plugin.Description = value.Description; + plugin.Author = value.Author; + plugin.IconPathDark = value.IconPathDark; + plugin.IconPathLight = value.IconPathLight; plugin.EnabledPolicyUiState = (int)enabledPolicyState; defaultPlugins[plugin.Id] = plugin; defaultPlugins[plugin.Id].AdditionalOptions = additionalOptions; diff --git a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs index 78698733f7..9eb3db97a8 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs @@ -1013,15 +1013,9 @@ namespace PowerLauncher.ViewModel /// public void UpdateResultView(List list, string originQuery, CancellationToken ct) { - if (list == null) - { - throw new ArgumentNullException(nameof(list)); - } + ArgumentNullException.ThrowIfNull(list); - if (originQuery == null) - { - throw new ArgumentNullException(nameof(originQuery)); - } + ArgumentNullException.ThrowIfNull(originQuery); foreach (var result in list) { @@ -1062,7 +1056,7 @@ namespace PowerLauncher.ViewModel else { // Using Ordinal this is internal - return string.IsNullOrEmpty(queryText) || autoCompleteText.IndexOf(queryText, StringComparison.Ordinal) != 0; + return string.IsNullOrEmpty(queryText) || !autoCompleteText.StartsWith(queryText, StringComparison.Ordinal); } } @@ -1073,7 +1067,7 @@ namespace PowerLauncher.ViewModel if (index == 0) { // Using OrdinalIgnoreCase because we want the characters to be exact in autocomplete text and the query - if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0) + if (input.StartsWith(query, StringComparison.OrdinalIgnoreCase)) { // Use the same case as the input query for the matched portion of the string return string.Concat(query, input.AsSpan(query.Length)); @@ -1091,7 +1085,7 @@ namespace PowerLauncher.ViewModel if (index == 0 && !string.IsNullOrEmpty(query)) { // Using OrdinalIgnoreCase since this is internal - if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0) + if (input.StartsWith(query, StringComparison.OrdinalIgnoreCase)) { return string.Concat(query, input.AsSpan(query.Length)); } diff --git a/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs index 047f0ab70b..29623ded3c 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs @@ -263,10 +263,7 @@ namespace PowerLauncher.ViewModel /// public void AddResults(List newRawResults, CancellationToken ct) { - if (newRawResults == null) - { - throw new ArgumentNullException(nameof(newRawResults)); - } + ArgumentNullException.ThrowIfNull(newRawResults); List newResults = new List(newRawResults.Count); foreach (Result r in newRawResults) diff --git a/src/modules/launcher/Wox.Infrastructure/Alphabet.cs b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs index 0d067c7953..fb81591047 100644 --- a/src/modules/launcher/Wox.Infrastructure/Alphabet.cs +++ b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs @@ -134,7 +134,7 @@ public class Alphabet : IAlphabet return _empty2DStringArray; } - if (!_pinyinCache.ContainsKey(characters)) + if (!_pinyinCache.TryGetValue(characters, out string[][] value)) { var allPinyins = new List(); foreach (var c in characters) @@ -158,7 +158,7 @@ public class Alphabet : IAlphabet } else { - return _pinyinCache[characters]; + return value; } } diff --git a/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs b/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs index 2f452bfe49..a40e60ccfa 100644 --- a/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs +++ b/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs @@ -20,20 +20,14 @@ namespace Wox.Infrastructure public static FuzzyMatcher Create(string query) { - if (query == null) - { - throw new ArgumentNullException(nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); return new FuzzyMatcher(query, new MatchOption()); } public static FuzzyMatcher Create(string query, MatchOption opt) { - if (query == null) - { - throw new ArgumentNullException(nameof(query)); - } + ArgumentNullException.ThrowIfNull(query); return new FuzzyMatcher(query, opt); } diff --git a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs index d850510c56..6532e79d9f 100644 --- a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs +++ b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs @@ -19,10 +19,7 @@ namespace Wox.Infrastructure /// public static long Debug(string message, Action action) { - if (action == null) - { - throw new ArgumentNullException(nameof(action)); - } + ArgumentNullException.ThrowIfNull(action); var stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); @@ -36,10 +33,7 @@ namespace Wox.Infrastructure public static long Normal(string message, Action action) { - if (action == null) - { - throw new ArgumentNullException(nameof(action)); - } + ArgumentNullException.ThrowIfNull(action); var stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); @@ -53,10 +47,7 @@ namespace Wox.Infrastructure public static void StartCount(string name, Action action) { - if (action == null) - { - throw new ArgumentNullException(nameof(action)); - } + ArgumentNullException.ThrowIfNull(action); var stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs index 5f16dc621a..132c1ef3c0 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs @@ -105,10 +105,7 @@ namespace Wox.Infrastructure.Storage public StoragePowerToysVersionInfo(string associatedFilePath, int type) { - if (associatedFilePath == null) - { - throw new ArgumentNullException(nameof(associatedFilePath)); - } + ArgumentNullException.ThrowIfNull(associatedFilePath); FilePath = GetFilePath(associatedFilePath, type); diff --git a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs index 4d84d875b6..3e48a829ce 100644 --- a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs +++ b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs @@ -90,10 +90,7 @@ namespace Wox.Infrastructure return new MatchResult(false, UserSettingSearchPrecision); } - if (opt == null) - { - throw new ArgumentNullException(nameof(opt)); - } + ArgumentNullException.ThrowIfNull(opt); query = query.Trim(); diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj index e14c06dde1..f145197420 100644 --- a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3} Library true diff --git a/src/modules/launcher/Wox.Plugin/AllowedLanguage.cs b/src/modules/launcher/Wox.Plugin/AllowedLanguage.cs index 8922b89064..e5b124ff7b 100644 --- a/src/modules/launcher/Wox.Plugin/AllowedLanguage.cs +++ b/src/modules/launcher/Wox.Plugin/AllowedLanguage.cs @@ -21,10 +21,7 @@ namespace Wox.Plugin public static bool IsAllowed(string language) { - if (language == null) - { - throw new ArgumentNullException(nameof(language)); - } + ArgumentNullException.ThrowIfNull(language); // Using InvariantCulture since this is a command line arg return language.ToUpper(CultureInfo.InvariantCulture) == CSharp.ToUpper(CultureInfo.InvariantCulture) diff --git a/src/modules/launcher/Wox.Plugin/Common/ShellCommand.cs b/src/modules/launcher/Wox.Plugin/Common/ShellCommand.cs index b7bfb4cfaf..b4756d3f06 100644 --- a/src/modules/launcher/Wox.Plugin/Common/ShellCommand.cs +++ b/src/modules/launcher/Wox.Plugin/Common/ShellCommand.cs @@ -18,10 +18,7 @@ namespace Wox.Plugin.Common public static Process RunAsDifferentUser(ProcessStartInfo processStartInfo) { - if (processStartInfo == null) - { - throw new ArgumentNullException(nameof(processStartInfo)); - } + ArgumentNullException.ThrowIfNull(processStartInfo); processStartInfo.Verb = "RunAsUser"; var process = Process.Start(processStartInfo); diff --git a/src/modules/launcher/Wox.Plugin/Logger/Log.cs b/src/modules/launcher/Wox.Plugin/Logger/Log.cs index a52fc63a8a..cef06a37c6 100644 --- a/src/modules/launcher/Wox.Plugin/Logger/Log.cs +++ b/src/modules/launcher/Wox.Plugin/Logger/Log.cs @@ -77,50 +77,35 @@ namespace Wox.Plugin.Logger public static void Info(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { - if (fullClassName == null) - { - throw new ArgumentNullException(nameof(fullClassName)); - } + ArgumentNullException.ThrowIfNull(fullClassName); LogInternal(LogLevel.Info, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Debug(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { - if (fullClassName == null) - { - throw new ArgumentNullException(nameof(fullClassName)); - } + ArgumentNullException.ThrowIfNull(fullClassName); LogInternal(LogLevel.Debug, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Warn(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { - if (fullClassName == null) - { - throw new ArgumentNullException(nameof(fullClassName)); - } + ArgumentNullException.ThrowIfNull(fullClassName); LogInternal(LogLevel.Warn, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Error(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { - if (fullClassName == null) - { - throw new ArgumentNullException(nameof(fullClassName)); - } + ArgumentNullException.ThrowIfNull(fullClassName); LogInternal(LogLevel.Error, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Exception(string message, System.Exception ex, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { - if (fullClassName == null) - { - throw new ArgumentNullException(nameof(fullClassName)); - } + ArgumentNullException.ThrowIfNull(fullClassName); LogInternalException(message, ex, fullClassName, methodName, sourceFilePath, sourceLineNumber); } diff --git a/src/modules/launcher/Wox.Plugin/Result.cs b/src/modules/launcher/Wox.Plugin/Result.cs index 140b1ded0a..91f026bbb2 100644 --- a/src/modules/launcher/Wox.Plugin/Result.cs +++ b/src/modules/launcher/Wox.Plugin/Result.cs @@ -33,10 +33,7 @@ namespace Wox.Plugin set { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } + ArgumentNullException.ThrowIfNull(value); // Using Ordinal since this is used internally _title = value.Replace("\n", " ", StringComparison.Ordinal); diff --git a/src/modules/launcher/Wox.Plugin/UserSelectedRecord.cs b/src/modules/launcher/Wox.Plugin/UserSelectedRecord.cs index 44ed05640a..f821e8477a 100644 --- a/src/modules/launcher/Wox.Plugin/UserSelectedRecord.cs +++ b/src/modules/launcher/Wox.Plugin/UserSelectedRecord.cs @@ -34,20 +34,14 @@ namespace Wox.Plugin public void Remove(Result result) { - if (result == null) - { - throw new ArgumentNullException(nameof(result)); - } + ArgumentNullException.ThrowIfNull(result); Records.Remove(result.ToString()); } public void Add(Result result) { - if (result == null) - { - throw new ArgumentNullException(nameof(result)); - } + ArgumentNullException.ThrowIfNull(result); var key = result.ToString(); if (Records.TryGetValue(key, out var value)) @@ -81,10 +75,7 @@ namespace Wox.Plugin public UserSelectedRecordItem GetSelectedData(Result result) { - if (result == null) - { - throw new ArgumentNullException(nameof(result)); - } + ArgumentNullException.ThrowIfNull(result); if (result != null && Records.TryGetValue(result.ToString(), out var value)) { diff --git a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj index daf9814fbd..d8feef2270 100644 --- a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj +++ b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj @@ -2,7 +2,7 @@ - net7.0-windows + net8.0-windows {8451ECDD-2EA4-4966-BB0A-7BBC40138E80} true Library diff --git a/src/modules/launcher/Wox.Test/Wox.Test.csproj b/src/modules/launcher/Wox.Test/Wox.Test.csproj index 2ebd0ca951..eb518a2301 100644 --- a/src/modules/launcher/Wox.Test/Wox.Test.csproj +++ b/src/modules/launcher/Wox.Test/Wox.Test.csproj @@ -2,7 +2,7 @@ - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {FF742965-9A80-41A5-B042-D6C7D3A21708} diff --git a/src/modules/peek/Peek.Common/Peek.Common.csproj b/src/modules/peek/Peek.Common/Peek.Common.csproj index 46dd0a440a..9612f2273d 100644 --- a/src/modules/peek/Peek.Common/Peek.Common.csproj +++ b/src/modules/peek/Peek.Common/Peek.Common.csproj @@ -1,11 +1,11 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 Peek.Common - win10-x86;win10-x64;win10-arm64 + win-x86;win-x64;win-arm64 true enable diff --git a/src/modules/peek/Peek.FilePreviewer/Peek.FilePreviewer.csproj b/src/modules/peek/Peek.FilePreviewer/Peek.FilePreviewer.csproj index f10a171428..9a7058ee44 100644 --- a/src/modules/peek/Peek.FilePreviewer/Peek.FilePreviewer.csproj +++ b/src/modules/peek/Peek.FilePreviewer/Peek.FilePreviewer.csproj @@ -1,11 +1,11 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 Peek.FilePreviewer - win10-x86;win10-x64;win10-arm64 + win-x86;win-x64;win-arm64 true enable true diff --git a/src/modules/peek/Peek.UI/Peek.UI.csproj b/src/modules/peek/Peek.UI/Peek.UI.csproj index 1c8a06d834..49d8e1503a 100644 --- a/src/modules/peek/Peek.UI/Peek.UI.csproj +++ b/src/modules/peek/Peek.UI/Peek.UI.csproj @@ -6,13 +6,13 @@ PowerToys Peek UI Peek.UI WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps app.manifest x86;x64;ARM64 - win10-x86;win10-x64;win10-arm64 + win-x86;win-x64;win-arm64 true true false @@ -37,10 +37,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/poweraccent/PowerAccent.Core/PowerAccent.Core.csproj b/src/modules/poweraccent/PowerAccent.Core/PowerAccent.Core.csproj index a3c1524fc1..2d7a2f5c7b 100644 --- a/src/modules/poweraccent/PowerAccent.Core/PowerAccent.Core.csproj +++ b/src/modules/poweraccent/PowerAccent.Core/PowerAccent.Core.csproj @@ -1,7 +1,7 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 win-x64;win-arm64 @@ -15,10 +15,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/poweraccent/PowerAccent.UI/PowerAccent.UI.csproj b/src/modules/poweraccent/PowerAccent.UI/PowerAccent.UI.csproj index be88b83789..4fefdd9dd8 100644 --- a/src/modules/poweraccent/PowerAccent.UI/PowerAccent.UI.csproj +++ b/src/modules/poweraccent/PowerAccent.UI/PowerAccent.UI.csproj @@ -2,7 +2,7 @@ WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 win-x64;win-arm64 @@ -21,10 +21,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h b/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h index f2358d7135..a000476999 100644 --- a/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h +++ b/src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.h @@ -1,9 +1,8 @@ #pragma once #include "KeyboardListener.g.h" - -#include #include +#include namespace winrt::PowerToys::PowerAccentKeyboardService::implementation { diff --git a/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj b/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj index 2f49a7f54a..72afb9e10d 100644 --- a/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj +++ b/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj @@ -17,16 +17,16 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 {805306FF-A562-4415-8DEF-E493BDC45918} Microsoft.PowerToys.PreviewHandler.Gcode - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 diff --git a/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj b/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj index e75a48227d..24ac171b7a 100644 --- a/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj +++ b/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj @@ -7,7 +7,7 @@ PowerToys.GcodeThumbnailProvider PowerToys.GcodeThumbnailProvider PowerToys GcodePreviewHandler - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -21,10 +21,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj index f9ff83bd76..850f08918b 100644 --- a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj +++ b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj @@ -11,8 +11,8 @@ false true true - win10-x64;win10-arm64 - net7.0-windows10.0.20348.0 + win-x64;win-arm64 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -20,10 +20,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 4e1785e537..74eeb2f948 100644 --- a/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,11 +5,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) - win10-$(Platform) + win-$(Platform) true False False diff --git a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj index 29969551e5..bb4da33302 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj +++ b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj @@ -10,23 +10,23 @@ false true true - win10-x64;win10-arm64 + win-x64;win-arm64 true - win10-x64 + win-x64 - win10-arm64 + win-arm64 Microsoft.PowerToys.PreviewHandler.Monaco - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 PowerToys.MonacoPreviewHandler diff --git a/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 4e1785e537..74eeb2f948 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,11 +5,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) - win10-$(Platform) + win-$(Platform) true False False diff --git a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj index 89f28c5604..33f1444658 100644 --- a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj +++ b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj @@ -17,16 +17,16 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 {69E1EE8D-143A-4060-9129-4658ACF14AAF} Microsoft.PowerToys.PreviewHandler.Pdf - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 PowerToys.PdfPreviewHandler diff --git a/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj b/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj index 2d3f00b0a9..6ba3939773 100644 --- a/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj +++ b/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj @@ -7,7 +7,7 @@ PowerToys.PdfThumbnailProvider PowerToys.PdfThumbnailProvider PowerToys PdfPreviewHandler - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -21,10 +21,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/previewpane/QoiPreviewHandler/QoiPreviewHandler.csproj b/src/modules/previewpane/QoiPreviewHandler/QoiPreviewHandler.csproj index 8ba906c5e0..462ba6cd7a 100644 --- a/src/modules/previewpane/QoiPreviewHandler/QoiPreviewHandler.csproj +++ b/src/modules/previewpane/QoiPreviewHandler/QoiPreviewHandler.csproj @@ -17,16 +17,16 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 {6B04803D-B418-4833-A67E-B0FC966636A5} Microsoft.PowerToys.PreviewHandler.Qoi - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 diff --git a/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj b/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj index e78b84b355..9ae42bb515 100644 --- a/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj +++ b/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj @@ -7,7 +7,7 @@ PowerToys.QoiThumbnailProvider PowerToys.QoiThumbnailProvider PowerToys QoiPreviewHandler - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -21,10 +21,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/previewpane/STATestMethodAttribute.cs b/src/modules/previewpane/STATestMethodAttribute.cs index 42b7387a34..834307d949 100644 --- a/src/modules/previewpane/STATestMethodAttribute.cs +++ b/src/modules/previewpane/STATestMethodAttribute.cs @@ -24,10 +24,7 @@ namespace Microsoft.PowerToys.STATestExtension public override TestResult[] Execute(ITestMethod testMethod) { - if (testMethod == null) - { - throw new ArgumentNullException(nameof(testMethod)); - } + ArgumentNullException.ThrowIfNull(testMethod); if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) { diff --git a/src/modules/previewpane/StlThumbnailProvider/StlThumbnailProvider.csproj b/src/modules/previewpane/StlThumbnailProvider/StlThumbnailProvider.csproj index 89978b13f8..6dc5b9cc24 100644 --- a/src/modules/previewpane/StlThumbnailProvider/StlThumbnailProvider.csproj +++ b/src/modules/previewpane/StlThumbnailProvider/StlThumbnailProvider.csproj @@ -7,7 +7,7 @@ PowerToys.StlThumbnailProvider PowerToys.StlThumbnailProvider PowerToys StlPreviewHandler - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -22,10 +22,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 4e1785e537..74eeb2f948 100644 --- a/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,11 +5,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) - win10-$(Platform) + win-$(Platform) true False False diff --git a/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj b/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj index a4788401d4..9bb25fbd6b 100644 --- a/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj +++ b/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj @@ -12,8 +12,8 @@ false true true - win10-x64;win10-arm64 - net7.0-windows10.0.20348.0 + win-x64;win-arm64 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -21,10 +21,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 4e1785e537..74eeb2f948 100644 --- a/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,11 +5,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) - win10-$(Platform) + win-$(Platform) true False False diff --git a/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj b/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj index 8a2602dda2..09d3112f57 100644 --- a/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj +++ b/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj @@ -7,7 +7,7 @@ PowerToys.SvgThumbnailProvider PowerToys.SvgThumbnailProvider PowerToys SvgPreviewHandler - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 true @@ -17,16 +17,16 @@ false false true - win10-x64;win10-arm64 + win-x64;win-arm64 true - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj b/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj index 6c001f69bb..d2ecfdcf7e 100644 --- a/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj @@ -9,7 +9,7 @@ {FCF3E52D-B80A-4FC3-98FD-6391354F0EE3} PdfPreviewHandlerUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj index 8b309a5391..b79e1ffa8e 100644 --- a/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj @@ -9,7 +9,7 @@ {133281D8-1BCE-4D07-B31E-796612A9609E} GcodeThumbnailProviderUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj b/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj index 57a81b4bd1..0fe067ef37 100644 --- a/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj @@ -10,7 +10,7 @@ {A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A} PreviewPaneUnitTests PreviewPaneUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj b/src/modules/previewpane/UnitTests-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj index ca5e98ec47..d23bfedcd2 100644 --- a/src/modules/previewpane/UnitTests-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj @@ -9,7 +9,7 @@ {ECC20689-002A-4354-95A6-B58DF089C6FF} PdfPreviewHandlerUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj index 7e71706fc7..599da7826a 100644 --- a/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj @@ -9,7 +9,7 @@ {F40C3397-1834-4530-B2D9-8F8B8456BCDF} PdfThumbnailProviderUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj b/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj index d2ee9ef320..546d5a8900 100644 --- a/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj +++ b/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj @@ -9,7 +9,7 @@ {748417CA-F17E-487F-9411-CAFB6D3F4877} PreviewHandlerCommonUnitTests - net7.0-windows + net8.0-windows {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages diff --git a/src/modules/previewpane/UnitTests-QoiPreviewHandler/UnitTests-QoiPreviewHandler.csproj b/src/modules/previewpane/UnitTests-QoiPreviewHandler/UnitTests-QoiPreviewHandler.csproj index 6f48cfca68..602bc81a95 100644 --- a/src/modules/previewpane/UnitTests-QoiPreviewHandler/UnitTests-QoiPreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-QoiPreviewHandler/UnitTests-QoiPreviewHandler.csproj @@ -9,7 +9,7 @@ {3940AD4D-F748-4BE4-9083-85769CD553EF} PdfPreviewHandlerUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-QoiThumbnailProvider/UnitTests-QoiThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-QoiThumbnailProvider/UnitTests-QoiThumbnailProvider.csproj index 6bdeabad59..42ae6ee19d 100644 --- a/src/modules/previewpane/UnitTests-QoiThumbnailProvider/UnitTests-QoiThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-QoiThumbnailProvider/UnitTests-QoiThumbnailProvider.csproj @@ -9,7 +9,7 @@ {F8FFFC12-A31A-4AFA-B3DF-14DCF42B5E38} QoiThumbnailProviderUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-StlThumbnailProvider/UnitTests-StlThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-StlThumbnailProvider/UnitTests-StlThumbnailProvider.csproj index c7ef0a37ab..8581a8792a 100644 --- a/src/modules/previewpane/UnitTests-StlThumbnailProvider/UnitTests-StlThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-StlThumbnailProvider/UnitTests-StlThumbnailProvider.csproj @@ -9,7 +9,7 @@ {F1F6B6B6-9F18-4A17-8B5C-97DF552C53DC} StlThumbnailProviderUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj b/src/modules/previewpane/UnitTests-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj index 0195936478..863d78cce4 100644 --- a/src/modules/previewpane/UnitTests-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj @@ -9,7 +9,7 @@ {060D75DA-2D1C-48E6-A4A1-6F0718B64661} SvgPreviewHandlerUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/UnitTests-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj index 6aec341be5..c115b9a447 100644 --- a/src/modules/previewpane/UnitTests-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj @@ -9,7 +9,7 @@ {1EF1EEF0-10F0-4F2E-8550-39B6D8044D3E} SvgThumbnailProviderUnitTests - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/previewpane/common/PreviewHandlerCommon.csproj b/src/modules/previewpane/common/PreviewHandlerCommon.csproj index 30a7f48962..99a6b2ed43 100644 --- a/src/modules/previewpane/common/PreviewHandlerCommon.csproj +++ b/src/modules/previewpane/common/PreviewHandlerCommon.csproj @@ -15,7 +15,7 @@ {AF2349B8-E5B6-4004-9502-687C1C7730B1} - net7.0-windows + net8.0-windows PowerToys.PreviewHandlerCommon diff --git a/src/modules/previewpane/common/Utilities/ReadonlyStream.cs b/src/modules/previewpane/common/Utilities/ReadonlyStream.cs index a76286f769..a8c3bcbec4 100644 --- a/src/modules/previewpane/common/Utilities/ReadonlyStream.cs +++ b/src/modules/previewpane/common/Utilities/ReadonlyStream.cs @@ -242,10 +242,7 @@ namespace Common.Utilities [MemberNotNull(nameof(_stream))] private void CheckDisposed() { - if (_stream == null) - { - throw new ObjectDisposedException(nameof(ReadonlyStream)); - } + ObjectDisposedException.ThrowIf(_stream == null, this); } } } diff --git a/src/modules/registrypreview/RegistryPreviewUI/RegistryPreviewUI.csproj b/src/modules/registrypreview/RegistryPreviewUI/RegistryPreviewUI.csproj index 536e0938ca..9c0cae5d7b 100644 --- a/src/modules/registrypreview/RegistryPreviewUI/RegistryPreviewUI.csproj +++ b/src/modules/registrypreview/RegistryPreviewUI/RegistryPreviewUI.csproj @@ -2,7 +2,7 @@ WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 x86;x64;arm64 @@ -38,10 +38,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/settings-ui/Settings.UI.Library/AppSpecificKeysDataModel.cs b/src/settings-ui/Settings.UI.Library/AppSpecificKeysDataModel.cs index d205c3ff66..dc4885e38c 100644 --- a/src/settings-ui/Settings.UI.Library/AppSpecificKeysDataModel.cs +++ b/src/settings-ui/Settings.UI.Library/AppSpecificKeysDataModel.cs @@ -25,10 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library public bool Compare(AppSpecificKeysDataModel arg) { - if (arg == null) - { - throw new ArgumentNullException(nameof(arg)); - } + ArgumentNullException.ThrowIfNull(arg); // Using Ordinal comparison for internal text return OriginalKeys.Equals(arg.OriginalKeys, StringComparison.Ordinal) && diff --git a/src/settings-ui/Settings.UI.Library/ColorPickerSettings.cs b/src/settings-ui/Settings.UI.Library/ColorPickerSettings.cs index db43fe2bd7..ae50dd4085 100644 --- a/src/settings-ui/Settings.UI.Library/ColorPickerSettings.cs +++ b/src/settings-ui/Settings.UI.Library/ColorPickerSettings.cs @@ -34,10 +34,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/ColorPickerSettingsVersion1.cs b/src/settings-ui/Settings.UI.Library/ColorPickerSettingsVersion1.cs index ffd4e8ca26..efaa5a2fd5 100644 --- a/src/settings-ui/Settings.UI.Library/ColorPickerSettingsVersion1.cs +++ b/src/settings-ui/Settings.UI.Library/ColorPickerSettingsVersion1.cs @@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs b/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs index 0263d88bfc..5189fc7842 100644 --- a/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs +++ b/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs @@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs b/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs index 8828b1bbae..683746392f 100644 --- a/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs +++ b/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs @@ -25,10 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library public FileLocksmithSettings(FileLocksmithLocalProperties localProperties) { - if (localProperties == null) - { - throw new ArgumentNullException(nameof(localProperties)); - } + ArgumentNullException.ThrowIfNull(localProperties); Properties = new FileLocksmithProperties(); Properties.ExtendedContextMenuOnly.Value = localProperties.ExtendedContextMenuOnly; diff --git a/src/settings-ui/Settings.UI.Library/HostsSettings.cs b/src/settings-ui/Settings.UI.Library/HostsSettings.cs index 1a28dbcceb..6841b9d8f0 100644 --- a/src/settings-ui/Settings.UI.Library/HostsSettings.cs +++ b/src/settings-ui/Settings.UI.Library/HostsSettings.cs @@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/ImageSize.cs b/src/settings-ui/Settings.UI.Library/ImageSize.cs index 45d79a6bb2..8e766d38cc 100644 --- a/src/settings-ui/Settings.UI.Library/ImageSize.cs +++ b/src/settings-ui/Settings.UI.Library/ImageSize.cs @@ -225,10 +225,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library public void Update(ImageSize modifiedSize) { - if (modifiedSize == null) - { - throw new ArgumentNullException(nameof(modifiedSize)); - } + ArgumentNullException.ThrowIfNull(modifiedSize); Id = modifiedSize.Id; Name = modifiedSize.Name; diff --git a/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs b/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs index 2c0cf9eb3b..934351e5ad 100644 --- a/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs @@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs index 03259c38a3..31e6a035b9 100644 --- a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs @@ -98,10 +98,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library IncludeFields = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/PastePlainSettings.cs b/src/settings-ui/Settings.UI.Library/PastePlainSettings.cs index bf0ee98cfe..09b7389ccb 100644 --- a/src/settings-ui/Settings.UI.Library/PastePlainSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PastePlainSettings.cs @@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/PeekSettings.cs b/src/settings-ui/Settings.UI.Library/PeekSettings.cs index a4bbb0584a..e9ba1d1728 100644 --- a/src/settings-ui/Settings.UI.Library/PeekSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PeekSettings.cs @@ -42,10 +42,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs b/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs index b85906a001..71bf23a92a 100644 --- a/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs @@ -36,10 +36,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs b/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs index 160db21d73..49379cb05a 100644 --- a/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs @@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library WriteIndented = true, }; - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName); } diff --git a/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs b/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs index 1673dc2f11..39c20a3af1 100644 --- a/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs @@ -24,10 +24,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library public PowerRenameSettings(PowerRenameLocalProperties localProperties) { - if (localProperties == null) - { - throw new ArgumentNullException(nameof(localProperties)); - } + ArgumentNullException.ThrowIfNull(localProperties); Properties = new PowerRenameProperties(); Properties.PersistState.Value = localProperties.PersistState; diff --git a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj index d530c644b5..437874b15d 100644 --- a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj +++ b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj @@ -3,7 +3,7 @@ - net7.0-windows + net8.0-windows $(Version).0 Microsoft Corporation PowerToys @@ -14,10 +14,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs b/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs index 8315c52bdb..c6cf7d13b3 100644 --- a/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs +++ b/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs @@ -858,10 +858,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library /// private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRestoreSettings) { - if (backupRestoreSettings == null) - { - throw new ArgumentNullException(nameof(backupRestoreSettings)); - } + ArgumentNullException.ThrowIfNull(backupRestoreSettings); if (backupRestoreSettings["IgnoredPTRunSettings"] != null) { @@ -876,10 +873,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library /// private static string[] GetIgnoredSettings(JsonNode backupRestoreSettings, string settingFileKey) { - if (backupRestoreSettings == null) - { - throw new ArgumentNullException(nameof(backupRestoreSettings)); - } + ArgumentNullException.ThrowIfNull(backupRestoreSettings); if (settingFileKey.StartsWith("\\", StringComparison.OrdinalIgnoreCase)) { diff --git a/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs b/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs index 4f75ae6a25..49f31e4442 100644 --- a/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs +++ b/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs @@ -114,14 +114,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities { // Split up the version strings into int[] // Example: v10.0.2 -> {10, 0, 2}; - if (version1 == null) - { - throw new ArgumentNullException(nameof(version1)); - } - else if (version2 == null) - { - throw new ArgumentNullException(nameof(version2)); - } + ArgumentNullException.ThrowIfNull(version1); + ArgumentNullException.ThrowIfNull(version2); var v1 = version1.Substring(1).Split('.').Select(int.Parse).ToArray(); var v2 = version2.Substring(1).Split('.').Select(int.Parse).ToArray(); diff --git a/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs b/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs index c298670ee5..4e2b9d18b5 100644 --- a/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs +++ b/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs @@ -86,10 +86,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility public static void VerifyModuleIOProviderWasRead(Mock provider, string module, int expectedCallCount) { - if (provider == null) - { - throw new ArgumentNullException(nameof(provider)); - } + ArgumentNullException.ThrowIfNull(provider); Expression> filterExpression = ModuleFilterExpression(module); @@ -110,10 +107,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility public static void VerifyGeneralSettingsIOProviderWasRead(Mock provider, int expectedCallCount) { - if (provider == null) - { - throw new ArgumentNullException(nameof(provider)); - } + ArgumentNullException.ThrowIfNull(provider); IIOProviderMocks.VerifyIOReadWithStubFile(provider, SettingsFilterExpression, expectedCallCount); } diff --git a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj index f82cc27cc6..17b5681ffc 100644 --- a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj +++ b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj @@ -1,11 +1,11 @@  - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 false - win10-x64;win10-arm64 + win-x64;win-arm64 $(Version).0 diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj index 98be30ec56..bffa7cc353 100644 --- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj +++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj @@ -2,12 +2,12 @@ WinExe - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 Microsoft.PowerToys.Settings.UI app.manifest - win10-x64;win10-arm64 + win-x64;win-arm64 true true None @@ -31,10 +31,10 @@ - win10-x64 + win-x64 - win10-arm64 + win-arm64 diff --git a/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 1a0c71a859..800c6473ca 100644 --- a/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,11 +5,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net7.0-windows10.0.20348.0 + net8.0-windows10.0.20348.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration)\WinUI3Apps - win10-$(Platform) + win-$(Platform) true False False diff --git a/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs index 8df6bfa896..97409f376c 100644 --- a/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs @@ -27,28 +27,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public AlwaysOnTopViewModel(ISettingsUtils settingsUtils, ISettingsRepository settingsRepository, ISettingsRepository moduleSettingsRepository, Func ipcMSGCallBackFunc) { - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); SettingsUtils = settingsUtils; // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; InitializeEnabledValue(); // To obtain the settings configurations of AlwaysOnTop. - if (moduleSettingsRepository == null) - { - throw new ArgumentNullException(nameof(moduleSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(moduleSettingsRepository); Settings = moduleSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs index 7a64a07d85..43a7736510 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs @@ -49,10 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels Func ipcMSGCallBackFunc) { // Obtain the general PowerToy settings configurations - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs index 4100ec2c03..e855174e25 100644 --- a/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs @@ -26,28 +26,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public CropAndLockViewModel(ISettingsUtils settingsUtils, ISettingsRepository settingsRepository, ISettingsRepository moduleSettingsRepository, Func ipcMSGCallBackFunc) { - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); SettingsUtils = settingsUtils; // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; InitializeEnabledValue(); // To obtain the settings configurations of CropAndLock. - if (moduleSettingsRepository == null) - { - throw new ArgumentNullException(nameof(moduleSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(moduleSettingsRepository); Settings = moduleSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs index 1a9efd3d7f..4280d086cf 100644 --- a/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs @@ -46,27 +46,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public FancyZonesViewModel(SettingsUtils settingsUtils, ISettingsRepository settingsRepository, ISettingsRepository moduleSettingsRepository, Func ipcMSGCallBackFunc, string configFileSubfolder = "") { - if (settingsUtils == null) - { - throw new ArgumentNullException(nameof(settingsUtils)); - } + ArgumentNullException.ThrowIfNull(settingsUtils); SettingsUtils = settingsUtils; // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; settingsConfigFileFolder = configFileSubfolder; // To obtain the settings configurations of Fancy zones. - if (moduleSettingsRepository == null) - { - throw new ArgumentNullException(nameof(moduleSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(moduleSettingsRepository); Settings = moduleSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs index c974bcfda5..c79a42d83c 100644 --- a/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs @@ -29,10 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils)); // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs index 8bb2658e17..316623f247 100644 --- a/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs @@ -83,10 +83,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels ResourceLoader = resourceLoader; // To obtain the general settings configuration of PowerToys if it exists, else to create a new file and return the default configurations. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; UpdatingSettingsConfig = UpdatingSettings.LoadSettings(); diff --git a/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs index 03a51ca938..c0ae29ed59 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs @@ -32,10 +32,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils)); // To obtain the general settings configurations of PowerToys. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs index 8f53ba6e7c..679a3e9963 100644 --- a/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs @@ -55,10 +55,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public KeyboardManagerViewModel(ISettingsUtils settingsUtils, ISettingsRepository settingsRepository, Func ipcMSGCallBackFunc, Func, int> filterRemapKeysList) { - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs index 2823ecf306..5257c677c5 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs @@ -29,19 +29,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { SettingsUtils = settingsUtils; - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; InitializeEnabledValue(); - if (measureToolSettingsRepository == null) - { - throw new ArgumentNullException(nameof(measureToolSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(measureToolSettingsRepository); Settings = measureToolSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs index 0120fd3591..f7b9934e58 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs @@ -32,10 +32,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SettingsUtils = settingsUtils; // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; @@ -43,10 +40,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels // To obtain the find my mouse settings, if the file exists. // If not, to create a file with the default settings and to return the default configurations. - if (findMyMouseSettingsRepository == null) - { - throw new ArgumentNullException(nameof(findMyMouseSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(findMyMouseSettingsRepository); FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig; _findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value < 4 ? FindMyMouseSettingsConfig.Properties.ActivationMethod.Value : 0; @@ -65,10 +59,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _findMyMouseExcludedApps = FindMyMouseSettingsConfig.Properties.ExcludedApps.Value; _findMyMouseShakingMinimumDistance = FindMyMouseSettingsConfig.Properties.ShakingMinimumDistance.Value; - if (mouseHighlighterSettingsRepository == null) - { - throw new ArgumentNullException(nameof(mouseHighlighterSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(mouseHighlighterSettingsRepository); MouseHighlighterSettingsConfig = mouseHighlighterSettingsRepository.SettingsConfig; string leftClickColor = MouseHighlighterSettingsConfig.Properties.LeftButtonClickColor.Value; @@ -85,18 +76,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _highlightFadeDurationMs = MouseHighlighterSettingsConfig.Properties.HighlightFadeDurationMs.Value; _highlighterAutoActivate = MouseHighlighterSettingsConfig.Properties.AutoActivate.Value; - if (mouseJumpSettingsRepository == null) - { - throw new ArgumentNullException(nameof(mouseJumpSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(mouseJumpSettingsRepository); MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig; MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += MouseJumpThumbnailSizePropertyChanged; - if (mousePointerCrosshairsSettingsRepository == null) - { - throw new ArgumentNullException(nameof(mousePointerCrosshairsSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(mousePointerCrosshairsSettingsRepository); MousePointerCrosshairsSettingsConfig = mousePointerCrosshairsSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs index 5a9d499055..5f37745c3f 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs @@ -379,10 +379,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _uiDispatcherQueue = uiDispatcherQueue; // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; @@ -470,10 +467,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void LoadViewModelFromSettings(MouseWithoutBordersSettings moduleSettings) { - if (moduleSettings == null) - { - throw new ArgumentNullException(nameof(moduleSettings)); - } + ArgumentNullException.ThrowIfNull(moduleSettings); Settings = moduleSettings; /* TODO: Error handling */ diff --git a/src/settings-ui/Settings.UI/ViewModels/PastePlainViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PastePlainViewModel.cs index 2ce9c200c0..e2e635022f 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PastePlainViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PastePlainViewModel.cs @@ -41,25 +41,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels Func ipcMSGCallBackFunc) { // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; // To obtain the settings configurations of Fancy zones. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); _settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils)); - if (pastePlainSettingsRepository == null) - { - throw new ArgumentNullException(nameof(pastePlainSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(pastePlainSettingsRepository); _pastePlainSettings = pastePlainSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs index 64ef0d0186..34a80a99a3 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs @@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public PeekViewModel(ISettingsUtils settingsUtils, ISettingsRepository settingsRepository, Func ipcMSGCallBackFunc) { // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs index d6f867306e..8f8e5792ed 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs @@ -76,10 +76,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public PowerAccentViewModel(ISettingsUtils settingsUtils, ISettingsRepository settingsRepository, Func ipcMSGCallBackFunc) { // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); _settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils)); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs index a31643e0ab..ad7d92bd3a 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs @@ -56,10 +56,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels this.isDark = isDark; // To obtain the general Settings configurations of PowerToys - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs index 2377a8e346..644fd8458f 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs @@ -74,25 +74,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels Func ipcMSGCallBackFunc) { // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; // To obtain the settings configurations of Fancy zones. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); _settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils)); - if (powerOcrsettingsRepository == null) - { - throw new ArgumentNullException(nameof(powerOcrsettingsRepository)); - } + ArgumentNullException.ThrowIfNull(powerOcrsettingsRepository); _powerOcrSettings = powerOcrsettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs index d5a190c554..6179677d29 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -30,19 +30,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _settingsConfigFileFolder = configFileSubfolder; // To obtain the general Settings configurations of PowerToys - if (generalSettingsRepository == null) - { - throw new ArgumentNullException(nameof(generalSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(generalSettingsRepository); GeneralSettingsConfig = generalSettingsRepository.SettingsConfig; // To obtain the PowerPreview settings if it exists. // If the file does not exist, to create a new one and return the default settings configurations. - if (moduleSettingsRepository == null) - { - throw new ArgumentNullException(nameof(moduleSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(moduleSettingsRepository); Settings = moduleSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs index 239f72724c..602c16cf6b 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs @@ -33,10 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _settingsConfigFileFolder = configFileSubfolder; _settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils)); - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs index fd3a6ce8ab..77a2e5c870 100644 --- a/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs @@ -22,10 +22,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public RegistryPreviewViewModel(ISettingsRepository settingsRepository, ISettingsRepository registryPreviewSettingsRepository, Func ipcMSGCallBackFunc) { // To obtain the general settings configurations of PowerToys Settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs index 3b8b4ac78a..1ec77c81dc 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs @@ -34,19 +34,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _settingsConfigFileFolder = configFileSubfolder; // To obtain the general PowerToys settings. - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; // To obtain the shortcut guide settings, if the file exists. // If not, to create a file with the default settings and to return the default configurations. - if (moduleSettingsRepository == null) - { - throw new ArgumentNullException(nameof(moduleSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(moduleSettingsRepository); Settings = moduleSettingsRepository.SettingsConfig; diff --git a/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs index 04c9d47f44..9dcda1e3c4 100644 --- a/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs @@ -44,10 +44,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { PickFileDialog = pickFileDialog; - if (settingsRepository == null) - { - throw new ArgumentNullException(nameof(settingsRepository)); - } + ArgumentNullException.ThrowIfNull(settingsRepository); GeneralSettingsConfig = settingsRepository.SettingsConfig; @@ -57,10 +54,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _settingsConfigFileFolder = configFileSubfolder; - if (videoConferenceSettingsRepository == null) - { - throw new ArgumentNullException(nameof(videoConferenceSettingsRepository)); - } + ArgumentNullException.ThrowIfNull(videoConferenceSettingsRepository); Settings = videoConferenceSettingsRepository.SettingsConfig;