🚧 [Dev][Build] .NET 8 Upgrade (#28655)

* 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 f469778996.

* 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 654d4a7f78.

* [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 <jaime@janeasystems.com>
This commit is contained in:
Jeremy Sinclair
2023-11-22 12:46:59 -05:00
committed by GitHub
parent b41129d489
commit b2b2856e52
206 changed files with 473 additions and 841 deletions

View File

@@ -27,28 +27,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public AlwaysOnTopViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<AlwaysOnTopSettings> moduleSettingsRepository, Func<string, int> 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;

View File

@@ -49,10 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
Func<string, int> ipcMSGCallBackFunc)
{
// Obtain the general PowerToy settings configurations
if (settingsRepository == null)
{
throw new ArgumentNullException(nameof(settingsRepository));
}
ArgumentNullException.ThrowIfNull(settingsRepository);
GeneralSettingsConfig = settingsRepository.SettingsConfig;

View File

@@ -26,28 +26,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public CropAndLockViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<CropAndLockSettings> moduleSettingsRepository, Func<string, int> 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;

View File

@@ -46,27 +46,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public FancyZonesViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> 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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;

View File

@@ -55,10 +55,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public KeyboardManagerViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<List<KeysDataModel>, int> filterRemapKeysList)
{
if (settingsRepository == null)
{
throw new ArgumentNullException(nameof(settingsRepository));
}
ArgumentNullException.ThrowIfNull(settingsRepository);
GeneralSettingsConfig = settingsRepository.SettingsConfig;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 */

View File

@@ -41,25 +41,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
Func<string, int> 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;

View File

@@ -31,10 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public PeekViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
// To obtain the general settings configurations of PowerToys Settings.
if (settingsRepository == null)
{
throw new ArgumentNullException(nameof(settingsRepository));
}
ArgumentNullException.ThrowIfNull(settingsRepository);
GeneralSettingsConfig = settingsRepository.SettingsConfig;

View File

@@ -76,10 +76,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public PowerAccentViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> 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;

View File

@@ -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;

View File

@@ -74,25 +74,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
Func<string, int> 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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -22,10 +22,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public RegistryPreviewViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<RegistryPreviewSettings> registryPreviewSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
// To obtain the general settings configurations of PowerToys Settings.
if (settingsRepository == null)
{
throw new ArgumentNullException(nameof(settingsRepository));
}
ArgumentNullException.ThrowIfNull(settingsRepository);
GeneralSettingsConfig = settingsRepository.SettingsConfig;

View File

@@ -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;

View File

@@ -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;