🚧 [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

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{BB23A474-5058-4F75-8FA3-5FE3DE53CDF4}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Community.PowerToys.Run.Plugin.UnitConverter</RootNamespace>

View File

@@ -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<Result> Query(Query query)
{
if (query == null)
{
throw new ArgumentNullException(paramName: nameof(query));
}
ArgumentNullException.ThrowIfNull(query);
// Parse
ConvertModel convertModel = InputInterpreter.Parse(query);

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{4D971245-7A70-41D5-BAA0-DDB5684CAF51}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Community.PowerToys.Run.Plugin.VSCodeWorkspaces</RootNamespace>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{D095BE44-1F2E-463E-A494-121892A75EA2}</ProjectGuid>
<UseWPF>true</UseWPF>
<Version>$(Version).0</Version>

View File

@@ -87,10 +87,7 @@ namespace Community.PowerToys.Run.Plugin.ValueGenerator
public List<Result> Query(Query query)
{
if (query == null)
{
throw new ArgumentNullException(paramName: nameof(query));
}
ArgumentNullException.ThrowIfNull(query);
var results = new List<Result>();
try

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{9F94B303-5E21-4364-9362-64426F8DB932}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Community.PowerToys.Run.Plugin.WebSearch</RootNamespace>

View File

@@ -55,10 +55,7 @@ namespace Community.PowerToys.Run.Plugin.WebSearch
public List<Result> Query(Query query)
{
if (query is null)
{
throw new ArgumentNullException(nameof(query));
}
ArgumentNullException.ThrowIfNull(query);
var results = new List<Result>();

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.Plugin.Folder.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

View File

@@ -23,10 +23,7 @@ namespace Microsoft.Plugin.Folder
public IEnumerable<IItemResult> Results(string actionKeyword, string search)
{
if (search == null)
{
throw new ArgumentNullException(nameof(search));
}
ArgumentNullException.ThrowIfNull(search);
if (!_environmentHelper.IsEnvironmentVariable(search))
{

View File

@@ -58,10 +58,7 @@ namespace Microsoft.Plugin.Folder
public List<Result> 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<Result> GetFolderPluginResults(Query query)
{
if (query == null)
{
throw new ArgumentNullException(paramName: nameof(query));
}
ArgumentNullException.ThrowIfNull(query);
var expandedName = FolderHelper.Expand(query.Search);

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Plugin.Folder</RootNamespace>

View File

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

View File

@@ -23,10 +23,7 @@ namespace Microsoft.Plugin.Folder.Sources
public IEnumerable<FolderLink> 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);

View File

@@ -24,10 +24,7 @@ namespace Microsoft.Plugin.Folder.Sources
public IEnumerable<IItemResult> Query(string querySearch)
{
if (querySearch == null)
{
throw new ArgumentNullException(nameof(querySearch));
}
ArgumentNullException.ThrowIfNull(querySearch);
return GetEnvironmentVariables(querySearch)
.OrderBy(v => v.Title)

View File

@@ -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<char> 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<IItemResult> Query(string search)
{
if (search == null)
{
throw new ArgumentNullException(nameof(search));
}
ArgumentNullException.ThrowIfNull(search);
var processed = Process(search);

View File

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

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{F8B870EB-D5F5-45BA-9CF7-A5C459818820}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Plugin.Indexer</RootNamespace>

View File

@@ -25,10 +25,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
public List<SearchResult> ExecuteQuery(ISearchQueryHelper queryHelper, string keyword)
{
if (queryHelper == null)
{
throw new ArgumentNullException(paramName: nameof(queryHelper));
}
ArgumentNullException.ThrowIfNull(queryHelper);
List<SearchResult> results = new List<SearchResult>();
@@ -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<SearchResult> 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);

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<IsPackable>false</IsPackable>

View File

@@ -157,10 +157,7 @@ namespace Microsoft.Plugin.Program
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
{
if (selectedResult == null)
{
throw new ArgumentNullException(nameof(selectedResult));
}
ArgumentNullException.ThrowIfNull(selectedResult);
var menuOptions = new List<ContextMenuResult>();
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);
}

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<ProjectGuid>{FDB3555B-58EF-4AE6-B5F1-904719637AB4}</ProjectGuid>

View File

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

View File

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

View File

@@ -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<ContextMenuResult> ContextMenus(string queryArguments, IPublicAPI api)
{
if (api == null)
{
throw new ArgumentNullException(nameof(api));
}
ArgumentNullException.ThrowIfNull(api);
var contextMenus = new List<ContextMenuResult>();
@@ -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);

View File

@@ -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<ContextMenuResult> ContextMenus(string queryArguments, IPublicAPI api)
{
if (api == null)
{
throw new ArgumentNullException(nameof(api));
}
ArgumentNullException.ThrowIfNull(api);
var contextMenus = new List<ContextMenuResult>();
@@ -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<Win32Program> All(ProgramPluginSettings settings)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
ArgumentNullException.ThrowIfNull(settings);
try
{

View File

@@ -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<string> GetAppPathFromQueueAsync(ConcurrentQueue<string> eventHandlingQueue, int dequeueDelay)
{
if (eventHandlingQueue == null)
{
throw new ArgumentNullException(nameof(eventHandlingQueue));
}
ArgumentNullException.ThrowIfNull(eventHandlingQueue);
string previousAppPath = string.Empty;

View File

@@ -85,10 +85,7 @@ namespace Microsoft.Plugin.Shell
public List<Result> Query(Query query)
{
if (query == null)
{
throw new ArgumentNullException(nameof(query));
}
ArgumentNullException.ThrowIfNull(query);
List<Result> results = new List<Result>();
string cmd = query.Search;

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Plugin.Shell</RootNamespace>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.Plugin.Uri.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{03276a39-d4e9-417c-8ffd-200b0ee5e871}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Plugin.Uri</RootNamespace>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.Plugin.WindowWalker.UnitTests</RootNamespace>
</PropertyGroup>

View File

@@ -26,15 +26,9 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// <returns>returns the index location of each of the letters of the matches</returns>
internal static List<int> 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
/// <returns>a list of the possible combinations that match the search text</returns>
internal static List<List<int>> GetAllMatchIndexes(bool[,] matches)
{
if (matches == null)
{
throw new ArgumentNullException(nameof(matches));
}
ArgumentNullException.ThrowIfNull(matches);
List<List<int>> results = new List<List<int>>();
@@ -127,10 +118,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// <returns>an integer representing the score</returns>
internal static int CalculateScoreForMatches(List<int> matches)
{
if (matches == null)
{
throw new ArgumentNullException(nameof(matches));
}
ArgumentNullException.ThrowIfNull(matches);
var score = 0;

View File

@@ -35,10 +35,7 @@ namespace Microsoft.Plugin.WindowWalker
public List<Result> Query(Query query)
{
if (query == null)
{
throw new ArgumentNullException(nameof(query));
}
ArgumentNullException.ThrowIfNull(query);
_cancellationTokenSource?.Cancel();
_cancellationTokenSource?.Dispose();

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{74F1B9ED-F59C-4FE7-B473-7B453E30837E}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Plugin.WindowWalker</RootNamespace>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{59BD9891-3837-438A-958D-ADC7F91F6F7E}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.Calculator</RootNamespace>

View File

@@ -36,15 +36,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
/// <returns>Number translator for target culture</returns>
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);
}

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<ProjectGuid>{212AD910-8488-4036-BE20-326931B75FB2}</ProjectGuid>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.OneNote</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Run.Plugin.OneNote</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>

View File

@@ -3,7 +3,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.PowerToys</RootNamespace>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.Registry</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Run.Plugin.Registry</AssemblyName>
<Version>$(Version).0</Version>

View File

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

View File

@@ -3,7 +3,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.Service</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Run.Plugin.Service</AssemblyName>
<Version>$(Version).0</Version>

View File

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

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.System.UnitTests</RootNamespace>
</PropertyGroup>

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.System</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Run.Plugin.System</AssemblyName>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests</RootNamespace>
</PropertyGroup>

View File

@@ -65,10 +65,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate
public List<Result> Query(Query query)
{
if (query == null)
{
throw new ArgumentNullException(paramName: nameof(query));
}
ArgumentNullException.ThrowIfNull(query);
return SearchController.ExecuteSearch(query, IconTheme);
}

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.TimeDate</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Run.Plugin.TimeDate</AssemblyName>

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{5043CECE-E6A7-4867-9CBE-02D27D83747A}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.WindowsSettings</RootNamespace>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

View File

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

View File

@@ -3,7 +3,7 @@
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.WindowsTerminal</RootNamespace>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<Version>$(Version).0</Version>

View File

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

View File

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

View File

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

View File

@@ -188,10 +188,7 @@ namespace PowerLauncher.Plugin
public static List<Result> 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<Result> 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)
{

View File

@@ -12,10 +12,7 @@ namespace PowerLauncher.Plugin
{
public static Dictionary<PluginPair, Query> Build(string text)
{
if (text == null)
{
throw new ArgumentNullException(nameof(text));
}
ArgumentNullException.ThrowIfNull(text);
text = text.Trim();
int longestActionKeywordLength = 0;

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyTitle>PowerToys.Run</AssemblyTitle>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<UseWPF>true</UseWPF>
@@ -26,10 +26,10 @@
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
<PropertyGroup Condition="'$(Platform)'=='x64'">
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
<RuntimeIdentifier>win10-arm64</RuntimeIdentifier>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">

View File

@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<PublishDir>$(PowerToysRoot)\$(Platform)\$(Configuration)</PublishDir>

View File

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

View File

@@ -1013,15 +1013,9 @@ namespace PowerLauncher.ViewModel
/// </summary>
public void UpdateResultView(List<Result> 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));
}

View File

@@ -263,10 +263,7 @@ namespace PowerLauncher.ViewModel
/// </summary>
public void AddResults(List<Result> newRawResults, CancellationToken ct)
{
if (newRawResults == null)
{
throw new ArgumentNullException(nameof(newRawResults));
}
ArgumentNullException.ThrowIfNull(newRawResults);
List<ResultViewModel> newResults = new List<ResultViewModel>(newRawResults.Count);
foreach (Result r in newRawResults)

View File

@@ -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<string[]>();
foreach (var c in characters)
@@ -158,7 +158,7 @@ public class Alphabet : IAlphabet
}
else
{
return _pinyinCache[characters];
return value;
}
}

View File

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

View File

@@ -19,10 +19,7 @@ namespace Wox.Infrastructure
/// </summary>
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();

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}</ProjectGuid>
<OutputType>Library</OutputType>
<UseWpf>true</UseWpf>

View File

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

View File

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

View File

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

View File

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

View File

@@ -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))
{

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ProjectGuid>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</ProjectGuid>
<UseWPF>true</UseWPF>
<OutputType>Library</OutputType>

View File

@@ -2,7 +2,7 @@
<Import Project="..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<ProjectGuid>{FF742965-9A80-41A5-B042-D6C7D3A21708}</ProjectGuid>