From a1643b0a2ea00f2bb5774dc99322cfdea5282894 Mon Sep 17 00:00:00 2001 From: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Date: Tue, 18 Jan 2022 15:52:22 +0100 Subject: [PATCH] Upgrade .NET Core 3.1 to .NET 5 (#15591) * Common.UI * ColorPicker * PT Run * File Explorer Add-ons * Awake * FZ Editor * ImageResizer * Interop * Docs * Installer * Fix test not being run - Downgrade MSTest.TestAdapter & MSTest.TestFramework * Update expect.txt * Test run fix --- .github/actions/spell-check/expect.txt | 2 + .../ci/templates/build-powertoys-steps.yml | 1 + .../modules/launcher/plugins/registry.md | 2 +- .../launcher/plugins/windowssettings.md | 2 +- installer/PowerToysSetup/PowerToys.wxs | 19 ++++++++ installer/PowerToysSetup/Product.wxs | 26 +++++++---- src/common/Common.UI/Common.UI.csproj | 4 +- .../Microsoft.Interop.Tests.csproj | 2 +- src/modules/awake/Awake/Awake.csproj | 8 ++-- src/modules/awake/Awake/Core/APIHelper.cs | 44 ++++--------------- src/modules/awake/Awake/NativeMethods.cs | 39 ++++++++++++++++ src/modules/awake/Awake/Program.cs | 4 +- .../ColorPickerUI/ColorPickerUI.csproj | 4 +- .../colorPicker/ColorPickerUI/Program.cs | 3 +- .../UnitTest-ColorPickerUI.csproj | 12 ++--- .../FancyZonesEditor/FancyZonesEditor.csproj | 4 +- .../tests/ImageResizerUITest.csproj | 16 +++---- .../imageresizer/ui/ImageResizerUI.csproj | 4 +- ...s.Run.Plugin.UnitConverter.UnitTest.csproj | 2 +- ....PowerToys.Run.Plugin.UnitConverter.csproj | 4 +- ...werToys.Run.Plugin.VSCodeWorkspaces.csproj | 10 +---- ...nity.PowerToys.Run.Plugin.WebSearch.csproj | 4 +- .../Microsoft.Plugin.Folder.UnitTests.csproj | 2 +- .../Microsoft.Plugin.Folder.csproj | 4 +- .../Microsoft.Plugin.Indexer.csproj | 4 +- .../Microsoft.Plugin.Program.UnitTests.csproj | 6 +-- .../Microsoft.Plugin.Program.csproj | 9 ++-- .../Programs/PackageWrapper.cs | 4 +- .../Microsoft.Plugin.Shell.csproj | 4 +- .../Microsoft.Plugin.Uri.UnitTests.csproj | 2 +- .../Microsoft.Plugin.Uri.csproj | 4 +- .../Components/Window.cs | 20 ++++----- .../Microsoft.Plugin.WindowWalker.csproj | 4 +- ...Toys.Run.Plugin.Calculator.UnitTest.csproj | 2 +- ...oft.PowerToys.Run.Plugin.Calculator.csproj | 4 +- .../Helper/RegistryHelperTest.cs | 4 +- ...rToys.Run.Plugin.Registry.UnitTests.csproj | 2 +- .../Helper/QueryHelper.cs | 4 +- .../Helper/RegistryHelper.cs | 17 +++++-- .../Helper/ResultHelper.cs | 6 ++- .../Helper/ValueHelper.cs | 7 +++ ...osoft.PowerToys.Run.Plugin.Registry.csproj | 2 +- ...rosoft.PowerToys.Run.Plugin.Service.csproj | 2 +- ...werToys.Run.Plugin.System.UnitTests.csproj | 2 +- ...crosoft.PowerToys.Run.Plugin.System.csproj | 4 +- .../Helper/ResultHelper.cs | 2 +- .../Helper/UnsupportedSettingsHelper.cs | 2 +- ...owerToys.Run.Plugin.WindowsSettings.csproj | 4 +- ...un.Plugin.WindowsTerminal.UnitTests.csproj | 6 +-- .../Helpers/TerminalQuery.cs | 10 ++++- ...owerToys.Run.Plugin.WindowsTerminal.csproj | 6 +-- .../launcher/PowerLauncher/App.xaml.cs | 2 +- .../Helper/LauncherNotificationActivator.cs | 23 ---------- .../Helper/WindowsInteropHelper.cs | 4 +- .../PowerLauncher/PowerLauncher.csproj | 6 +-- .../InstallationPublishProfile.pubxml | 2 +- .../PowerLauncher/PublicAPIInstance.cs | 12 ++--- .../Exception/ExceptionFormatter.cs | 5 ++- .../Storage/BinaryStorage`1.cs | 6 +++ .../Wox.Infrastructure.csproj | 4 +- .../launcher/Wox.Plugin/Wox.Plugin.csproj | 4 +- src/modules/launcher/Wox.Test/Wox.Test.csproj | 12 ++--- .../GcodePreviewHandler.csproj | 11 +---- .../GcodeThumbnailProvider.csproj | 4 +- .../MarkdownPreviewHandler.csproj | 4 +- .../PdfPreviewHandler.csproj | 12 +---- .../PdfPreviewHandlerControl.cs | 2 +- .../PdfThumbnailProvider.csproj | 12 +---- .../SvgPreviewHandler.csproj | 4 +- .../SvgThumbnailProvider.csproj | 4 +- .../UnitTests-GcodePreviewHandler.csproj | 12 ++--- .../UnitTests-GcodeThumbnailProvider.csproj | 8 ++-- .../UnitTests-MarkdownPreviewHandler.csproj | 2 +- .../UnitTests-PdfPreviewHandler.csproj | 12 ++--- .../UnitTests-PdfThumbnailProvider.csproj | 16 +++---- .../UnitTests-PreviewHandlerCommon.csproj | 2 +- .../UnitTests-SvgPreviewHandler.csproj | 2 +- .../UnitTests-SvgThumbnailProvider.csproj | 2 +- .../common/PreviewHandlerCommon.csproj | 4 +- 79 files changed, 291 insertions(+), 267 deletions(-) create mode 100644 src/modules/awake/Awake/NativeMethods.cs delete mode 100644 src/modules/launcher/PowerLauncher/Helper/LauncherNotificationActivator.cs diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 87491d3788..8188692c7f 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -201,6 +201,7 @@ cdecl CDeclaration CDEF cdpx +CEBB CENTERALIGN CFDB cguid @@ -1914,6 +1915,7 @@ SYSICONINDEX SYSKEY syskeydown SYSKEYUP +SYSLIB syslog SYSMENU systemd diff --git a/.pipelines/ci/templates/build-powertoys-steps.yml b/.pipelines/ci/templates/build-powertoys-steps.yml index d32cb5961f..d016b552aa 100644 --- a/.pipelines/ci/templates/build-powertoys-steps.yml +++ b/.pipelines/ci/templates/build-powertoys-steps.yml @@ -124,6 +124,7 @@ steps: **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests.dll !**\obj\** + !**\ref\** # Native dlls - task: VSTest@2 diff --git a/doc/devdocs/modules/launcher/plugins/registry.md b/doc/devdocs/modules/launcher/plugins/registry.md index d74672fb99..a222c5e9c5 100644 --- a/doc/devdocs/modules/launcher/plugins/registry.md +++ b/doc/devdocs/modules/launcher/plugins/registry.md @@ -78,7 +78,7 @@ The plugin use only these interfaces (all inside the `Main.cs`): | Name | Value | | --------------- | ------------------------------------------------------------------------------ | -| TargetFramework | `netcoreapp3.1` (means .NET Core 3.1) | +| TargetFramework | `net5.0-windows` (.NET 5) or `net5.0-windows10.0.18362.0` (OS version specific)| | LangVersion | `8.0` (mean C# 8.0) | | Platforms | `x64` | | Nullable | `true` | diff --git a/doc/devdocs/modules/launcher/plugins/windowssettings.md b/doc/devdocs/modules/launcher/plugins/windowssettings.md index 62244d928d..bf04461db0 100644 --- a/doc/devdocs/modules/launcher/plugins/windowssettings.md +++ b/doc/devdocs/modules/launcher/plugins/windowssettings.md @@ -141,7 +141,7 @@ Because the JSON file must have a object as root type, instead of a array. | Name | Value | | --------------- | --------------------------------------------------------------------------------------------------- | -| TargetFramework | `netcoreapp3.1` (means .NET Core 3.1) | +| TargetFramework | `net5.0-windows` (.NET 5) or `net5.0-windows10.0.18362.0` (OS version specific) | | Platforms | `x64` | | Output | `..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\` | | RootNamespace | `Microsoft.PowerToys.Run.Plugin.WindowsSettings` | diff --git a/installer/PowerToysSetup/PowerToys.wxs b/installer/PowerToysSetup/PowerToys.wxs index 31d6292454..5e1788218f 100644 --- a/installer/PowerToysSetup/PowerToys.wxs +++ b/installer/PowerToysSetup/PowerToys.wxs @@ -21,6 +21,7 @@ + @@ -55,6 +56,24 @@ Version="3.1.22.30721" Hash="08EF2F6CFDB33946061884B1CE13FA867EFBD576" /> + + + + @@ -539,8 +540,8 @@ - - + + @@ -584,8 +585,8 @@ - - + + @@ -771,7 +772,7 @@ - + @@ -789,15 +790,21 @@ - + + + + + + + + - @@ -850,6 +857,8 @@ + + @@ -1030,6 +1039,7 @@ + @@ -1330,7 +1340,7 @@ - + diff --git a/src/common/Common.UI/Common.UI.csproj b/src/common/Common.UI/Common.UI.csproj index 4b37818108..1444687378 100644 --- a/src/common/Common.UI/Common.UI.csproj +++ b/src/common/Common.UI/Common.UI.csproj @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows true x64 x64 diff --git a/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj b/src/common/interop/interop-tests/Microsoft.Interop.Tests.csproj index 1537c698eb..45e707cf2b 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 @@ - netcoreapp3.1 + net5.0-windows false win-x64 diff --git a/src/modules/awake/Awake/Awake.csproj b/src/modules/awake/Awake/Awake.csproj index 77c4f5b039..d18141e935 100644 --- a/src/modules/awake/Awake/Awake.csproj +++ b/src/modules/awake/Awake/Awake.csproj @@ -1,8 +1,8 @@ - + WinExe - netcoreapp3.1 + net5.0-windows $(SolutionDir)$(Platform)\$(Configuration)\modules\Awake enable x64 @@ -79,6 +79,8 @@ - + + Always + diff --git a/src/modules/awake/Awake/Core/APIHelper.cs b/src/modules/awake/Awake/Core/APIHelper.cs index 5e17380751..4f6d7ba8fa 100644 --- a/src/modules/awake/Awake/Core/APIHelper.cs +++ b/src/modules/awake/Awake/Core/APIHelper.cs @@ -51,32 +51,6 @@ namespace Awake.Core private static Task? _runnerThread; private static System.Timers.Timer _timedLoopTimer; - [DllImport("kernel32.dll", SetLastError = true)] - private static extern bool SetConsoleCtrlHandler(ConsoleEventHandler handler, bool add); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); - - [DllImport("kernel32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool AllocConsole(); - - [DllImport("kernel32.dll", SetLastError = true)] - private static extern bool SetStdHandle(int nStdHandle, IntPtr hHandle); - - [DllImport("kernel32.dll")] - private static extern uint GetCurrentThreadId(); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern IntPtr CreateFile( - [MarshalAs(UnmanagedType.LPTStr)] string filename, - [MarshalAs(UnmanagedType.U4)] uint access, - [MarshalAs(UnmanagedType.U4)] FileShare share, - IntPtr securityAttributes, - [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, - [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, - IntPtr templateFile); - static APIHelper() { _timedLoopTimer = new System.Timers.Timer(); @@ -86,19 +60,19 @@ namespace Awake.Core public static void SetConsoleControlHandler(ConsoleEventHandler handler, bool addHandler) { - SetConsoleCtrlHandler(handler, addHandler); + NativeMethods.SetConsoleCtrlHandler(handler, addHandler); } public static void AllocateConsole() { _log.Debug("Bootstrapping the console allocation routine."); - AllocConsole(); + NativeMethods.AllocConsole(); _log.Debug($"Console allocation result: {Marshal.GetLastWin32Error()}"); - var outputFilePointer = CreateFile("CONOUT$", GenericRead | GenericWrite, FileShare.Write, IntPtr.Zero, FileMode.OpenOrCreate, 0, IntPtr.Zero); + var outputFilePointer = NativeMethods.CreateFile("CONOUT$", GenericRead | GenericWrite, FileShare.Write, IntPtr.Zero, FileMode.OpenOrCreate, 0, IntPtr.Zero); _log.Debug($"CONOUT creation result: {Marshal.GetLastWin32Error()}"); - SetStdHandle(StdOutputHandle, outputFilePointer); + NativeMethods.SetStdHandle(StdOutputHandle, outputFilePointer); _log.Debug($"SetStdHandle result: {Marshal.GetLastWin32Error()}"); Console.SetOut(new StreamWriter(Console.OpenStandardOutput(), Console.OutputEncoding) { AutoFlush = true }); @@ -115,7 +89,7 @@ namespace Awake.Core { try { - var stateResult = SetThreadExecutionState(state); + var stateResult = NativeMethods.SetThreadExecutionState(state); return stateResult != 0; } catch @@ -205,7 +179,7 @@ namespace Awake.Core { if (success) { - _log.Info($"Initiated indefinite keep awake in background thread: {GetCurrentThreadId()}. Screen on: {keepDisplayOn}"); + _log.Info($"Initiated indefinite keep awake in background thread: {NativeMethods.GetCurrentThreadId()}. Screen on: {keepDisplayOn}"); WaitHandle.WaitAny(new[] { _threadToken.WaitHandle }); @@ -220,7 +194,7 @@ namespace Awake.Core catch (OperationCanceledException ex) { // Task was clearly cancelled. - _log.Info($"Background thread termination: {GetCurrentThreadId()}. Message: {ex.Message}"); + _log.Info($"Background thread termination: {NativeMethods.GetCurrentThreadId()}. Message: {ex.Message}"); return success; } } @@ -244,7 +218,7 @@ namespace Awake.Core if (success) { - _log.Info($"Initiated temporary keep awake in background thread: {GetCurrentThreadId()}. Screen on: {keepDisplayOn}"); + _log.Info($"Initiated temporary keep awake in background thread: {NativeMethods.GetCurrentThreadId()}. Screen on: {keepDisplayOn}"); _timedLoopTimer = new System.Timers.Timer(seconds * 1000); _timedLoopTimer.Elapsed += (s, e) => @@ -276,7 +250,7 @@ namespace Awake.Core catch (OperationCanceledException ex) { // Task was clearly cancelled. - _log.Info($"Background thread termination: {GetCurrentThreadId()}. Message: {ex.Message}"); + _log.Info($"Background thread termination: {NativeMethods.GetCurrentThreadId()}. Message: {ex.Message}"); return success; } } diff --git a/src/modules/awake/Awake/NativeMethods.cs b/src/modules/awake/Awake/NativeMethods.cs new file mode 100644 index 0000000000..2f0bc0d107 --- /dev/null +++ b/src/modules/awake/Awake/NativeMethods.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace Awake.Core +{ + internal static class NativeMethods + { + [DllImport("kernel32.dll", SetLastError = true)] + internal static extern bool SetConsoleCtrlHandler(ConsoleEventHandler handler, bool add); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + internal static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); + + [DllImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool AllocConsole(); + + [DllImport("kernel32.dll", SetLastError = true)] + internal static extern bool SetStdHandle(int nStdHandle, IntPtr hHandle); + + [DllImport("kernel32.dll")] + internal static extern uint GetCurrentThreadId(); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + internal static extern IntPtr CreateFile( + [MarshalAs(UnmanagedType.LPWStr)] string filename, + [MarshalAs(UnmanagedType.U4)] uint access, + [MarshalAs(UnmanagedType.U4)] FileShare share, + IntPtr securityAttributes, + [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, + [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, + IntPtr templateFile); + } +} diff --git a/src/modules/awake/Awake/Program.cs b/src/modules/awake/Awake/Program.cs index d69794b491..6f16543659 100644 --- a/src/modules/awake/Awake/Program.cs +++ b/src/modules/awake/Awake/Program.cs @@ -190,14 +190,16 @@ namespace Awake } }).Start(); - TrayHelper.InitializeTray(InternalConstants.FullAppName, new Icon(Application.GetResourceStream(new Uri("/Images/Awake.ico", UriKind.Relative)).Stream)); + TrayHelper.InitializeTray(InternalConstants.FullAppName, new Icon("modules/Awake/Images/Awake.ico")); string? settingsPath = _settingsUtils.GetSettingsFilePath(InternalConstants.AppName); _log.Info($"Reading configuration file: {settingsPath}"); _watcher = new FileSystemWatcher { +#pragma warning disable CS8601 // Possible null reference assignment. Path = Path.GetDirectoryName(settingsPath), +#pragma warning restore CS8601 // Possible null reference assignment. EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime, Filter = Path.GetFileName(settingsPath), diff --git a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj index 47692c1ccb..7b6d4cea79 100644 --- a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj +++ b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj @@ -1,4 +1,4 @@ - + PowerToys.ColorPickerUI @@ -21,7 +21,7 @@ WinExe ColorPicker PowerToys.ColorPickerUI - netcoreapp3.1 + net5.0-windows10.0.18362.0 8.0 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/src/modules/colorPicker/ColorPickerUI/Program.cs b/src/modules/colorPicker/ColorPickerUI/Program.cs index 7ca5aa36af..10a672e316 100644 --- a/src/modules/colorPicker/ColorPickerUI/Program.cs +++ b/src/modules/colorPicker/ColorPickerUI/Program.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics; using ColorPicker.Helpers; using ColorPicker.Mouse; @@ -19,7 +18,7 @@ namespace ColorPicker public static void Main(string[] args) { _args = args; - Logger.LogInfo($"Color Picker started with pid={Process.GetCurrentProcess().Id}"); + Logger.LogInfo($"Color Picker started with pid={Environment.ProcessId}"); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; try { diff --git a/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj b/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj index 3526efba07..d1672693cb 100644 --- a/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj +++ b/src/modules/colorPicker/UnitTest-ColorPickerUI/UnitTest-ColorPickerUI.csproj @@ -1,8 +1,8 @@  - - + + - netcoreapp3.1 + net5.0-windows10.0.18362.0 {090CD7B7-3B0C-4D1D-BC98-83EB5D799BC1} Microsoft.ColorPicker.UnitTests false @@ -12,7 +12,7 @@ x64 x64 true - $(Version).0 + $(Version).0 @@ -35,8 +35,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj index 804ddb611e..c896109388 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj +++ b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj @@ -1,4 +1,4 @@ - + PowerToys.FancyZonesEditor @@ -22,7 +22,7 @@ {5CCC8468-DEC8-4D36-99D4-5C891BEBD481} - netcoreapp3.1 + net5.0-windows10.0.18362.0 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ diff --git a/src/modules/imageresizer/tests/ImageResizerUITest.csproj b/src/modules/imageresizer/tests/ImageResizerUITest.csproj index 3f6df92bcd..1b79ee90c8 100644 --- a/src/modules/imageresizer/tests/ImageResizerUITest.csproj +++ b/src/modules/imageresizer/tests/ImageResizerUITest.csproj @@ -1,8 +1,8 @@  - + - netcoreapp3.1 + net5.0-windows10.0.18362.0 {E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8} Library Properties @@ -15,13 +15,13 @@ ..\..\..\codeAnalysis\Rules.ruleset x64 - + x64 true $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ - + x64 @@ -32,7 +32,7 @@ - + @@ -76,12 +76,12 @@ - - + + all - \ No newline at end of file + diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj index 8a3e5bccec..55be81ad27 100644 --- a/src/modules/imageresizer/ui/ImageResizerUI.csproj +++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj @@ -1,4 +1,4 @@ - + @@ -19,7 +19,7 @@ WinExe ImageResizer PowerToys.ImageResizer - netcoreapp3.1 + net5.0-windows10.0.18362.0 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ 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 df81c98476..019cc90816 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 @@ - netcoreapp3.1 + net5.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 b28dcf4bf1..2772451e05 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {BB23A474-5058-4F75-8FA3-5FE3DE53CDF4} Properties Community.PowerToys.Run.Plugin.UnitConverter 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 7d8522242f..bc35100d7b 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {4D971245-7A70-41D5-BAA0-DDB5684CAF51} Properties Community.PowerToys.Run.Plugin.VSCodeWorkspaces @@ -71,12 +71,6 @@ - - - C:\Program Files (x86)\Windows Kits\10\References\10.0.18362.0\Windows.Foundation.UniversalApiContract\8.0.0.0\Windows.Foundation.UniversalApiContract.winmd - - - Resources.resx 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 94f6e67606..da64d1018b 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {9F94B303-5E21-4364-9362-64426F8DB932} Properties Community.PowerToys.Run.Plugin.WebSearch 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 fdb9f0a4c0..056a1a4065 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 @@ - netcoreapp3.1 + net5.0-windows false x64 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 5c57fc3abb..808b84a812 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} Properties Microsoft.Plugin.Folder 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 06f487dea9..5985ac8ed8 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {F8B870EB-D5F5-45BA-9CF7-A5C459818820} Properties Microsoft.Plugin.Indexer 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 ecff2a34c0..7bdd99dee2 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 @@  - netcoreapp3.1 + net5.0-windows10.0.18362.0 false @@ -26,8 +26,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - + + 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 8b593159ab..845707d3b7 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows10.0.18362.0 {FDB3555B-58EF-4AE6-B5F1-904719637AB4} Properties Microsoft.Plugin.Program @@ -57,10 +57,10 @@ - + false - + false @@ -71,7 +71,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - 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 afe3c0e50c..260388cc43 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackageWrapper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackageWrapper.cs @@ -40,7 +40,7 @@ namespace Microsoft.Plugin.Program.Programs } private static readonly Lazy IsPackageDotInstallationPathAvailable = new Lazy(() => - ApiInformation.IsPropertyPresent(typeof(Package).FullName, nameof(Package.InstalledPath))); + ApiInformation.IsPropertyPresent(typeof(Package).FullName, nameof(Package.InstalledLocation.Path))); public static PackageWrapper GetWrapperFromPackage(Package package) { @@ -77,6 +77,6 @@ namespace Microsoft.Plugin.Program.Programs // This is a separate method so the reference to .InstalledPath won't be loaded in API versions which do not support this API (e.g. older then Build 19041) private static string GetInstalledPath(Package package) - => package.InstalledPath; + => package.InstalledLocation.Path; } } 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 3893af0f17..18f074da35 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.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 b781f88ec5..e16b55e155 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 @@  - netcoreapp3.1 + net5.0-windows false x64 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 9e476c813e..c880d30ca2 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {03276a39-d4e9-417c-8ffd-200b0ee5e871} Properties Microsoft.Plugin.Uri diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs index 59bf6471e3..bcbbdf2232 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs @@ -71,7 +71,7 @@ namespace Microsoft.Plugin.WindowWalker.Components public uint ProcessID { get; set; } /// - /// Gets returns the name of the process + /// Gets the name of the process /// public string ProcessName { @@ -128,7 +128,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Gets returns the name of the class for the window represented + /// Gets the name of the class for the window represented /// public string ClassName { @@ -147,7 +147,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Gets a value indicating whether is the window visible (might return false if it is a hidden IE tab) + /// Gets a value indicating whether the window is visible (might return false if it is a hidden IE tab) /// public bool Visible { @@ -158,7 +158,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Gets a value indicating whether determines whether the specified window handle identifies an existing window. + /// Gets a value indicating whether the specified window handle identifies an existing window. /// public bool IsWindow { @@ -169,7 +169,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Gets a value indicating whether get a value indicating whether is the window GWL_EX_STYLE is a toolwindow + /// Gets a value indicating whether the window is a toolwindow /// public bool IsToolWindow { @@ -182,7 +182,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Gets a value indicating whether get a value indicating whether the window GWL_EX_STYLE is an appwindow + /// Gets a value indicating whether the window is an appwindow /// public bool IsAppWindow { @@ -195,7 +195,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Gets a value indicating whether get a value indicating whether the window has ITaskList_Deleted property + /// Gets a value indicating whether the window has ITaskList_Deleted property /// public bool TaskListDeleted { @@ -206,18 +206,18 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Gets a value indicating whether determines whether the specified windows is the owner + /// Gets a value indicating whether the specified windows is the owner (i.e. doesn't have an owner) /// public bool IsOwner { get { - return NativeMethods.GetWindow(Hwnd, NativeMethods.GetWindowCmd.GW_OWNER) != null; + return NativeMethods.GetWindow(Hwnd, NativeMethods.GetWindowCmd.GW_OWNER) == IntPtr.Zero; } } /// - /// Gets a value indicating whether returns true if the window is minimized + /// Gets a value indicating whether the window is minimized /// public bool Minimized { 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 476c7ac4d1..46d2449bd1 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.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 8dff757af6..7158e785c1 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 @@ - netcoreapp3.1 + net5.0-windows false x64 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 f38db5ca5b..1afa4aba61 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {59BD9891-3837-438A-958D-ADC7F91F6F7E} Properties Microsoft.PowerToys.Run.Plugin.Calculator diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Helper/RegistryHelperTest.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Helper/RegistryHelperTest.cs index 8855d3e23e..f797b84328 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Helper/RegistryHelperTest.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry.UnitTest/Helper/RegistryHelperTest.cs @@ -22,8 +22,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.UnitTest.Helper public void GetRegistryBaseKeyTestOnlyOneBaseKey(string query, string expectedBaseKey) { var (baseKeyList, _) = RegistryHelper.GetRegistryBaseKey(query); + Assert.IsNotNull(baseKeyList); Assert.IsTrue(baseKeyList.Count() == 1); - Assert.AreEqual(expectedBaseKey, baseKeyList.FirstOrDefault().Name); + Assert.AreEqual(expectedBaseKey, baseKeyList.First().Name); } [TestMethod] @@ -31,6 +32,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.UnitTest.Helper { var (baseKeyList, _) = RegistryHelper.GetRegistryBaseKey("HKC\\Control Panel\\Accessibility"); /* #no-spell-check-line */ + Assert.IsNotNull(baseKeyList); Assert.IsTrue(baseKeyList.Count() > 1); var list = baseKeyList.Select(found => found.Name); 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 3819a1031d..907db2d715 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 @@  - netcoreapp3.1 + net5.0-windows x64 en-US 8.0 diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/QueryHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/QueryHelper.cs index 3e37f3b193..8b8371ff11 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/QueryHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/QueryHelper.cs @@ -50,8 +50,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper var querySplit = query.Split(QuerySplitCharacter); - queryKey = querySplit.FirstOrDefault(); - queryValueName = querySplit.LastOrDefault(); + queryKey = querySplit.First(); + queryValueName = querySplit.Last(); return true; } diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/RegistryHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/RegistryHelper.cs index 7c890ba36b..6d3424d461 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/RegistryHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/RegistryHelper.cs @@ -51,7 +51,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper return (null, string.Empty); } - var baseKey = query.Split('\\').FirstOrDefault(); + var baseKey = query.Split('\\').FirstOrDefault() ?? string.Empty; var subKey = query.Replace(baseKey, string.Empty, StringComparison.InvariantCultureIgnoreCase).TrimStart('\\'); var baseKeyResult = _baseKeys @@ -100,7 +100,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper do { - result = FindSubKey(subKey, subKeysNames.ElementAtOrDefault(index)); + result = FindSubKey(subKey, subKeysNames.ElementAtOrDefault(index) ?? string.Empty); if (result.Count == 0) { @@ -169,13 +169,22 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper if (string.Equals(subKey, searchSubKey, StringComparison.InvariantCultureIgnoreCase)) { - list.Add(new RegistryEntry(parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree))); + var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree); + if (key != null) + { + list.Add(new RegistryEntry(key)); + } + return list; } try { - list.Add(new RegistryEntry(parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree))); + var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree); + if (key != null) + { + list.Add(new RegistryEntry(key)); + } } catch (Exception exception) { diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ResultHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ResultHelper.cs index b6f1b050f8..7c70ddbedb 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ResultHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ResultHelper.cs @@ -94,7 +94,11 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper { foreach (var valueName in valueNames) { - valueList.Add(KeyValuePair.Create(valueName, key.GetValue(valueName))); + var value = key.GetValue(valueName); + if (value != null) + { + valueList.Add(KeyValuePair.Create(valueName, value)); + } } } catch (Exception valueException) diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ValueHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ValueHelper.cs index d3bf3a9790..efda9bfa23 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ValueHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/Helper/ValueHelper.cs @@ -25,11 +25,18 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper { var unformattedValue = key.GetValue(valueName); + if (unformattedValue == null) + { + throw new NullReferenceException(nameof(unformattedValue)); + } + var valueData = key.GetValueKind(valueName) switch { RegistryValueKind.DWord => $"0x{unformattedValue:X8} ({(uint)(int)unformattedValue})", RegistryValueKind.QWord => $"0x{unformattedValue:X16} ({(ulong)(long)unformattedValue})", +#pragma warning disable CS8604 // Possible null reference argument. RegistryValueKind.Binary => (unformattedValue as byte[]).Aggregate(string.Empty, (current, singleByte) => $"{current} {singleByte:X2}"), +#pragma warning restore CS8604 // Possible null reference argument. _ => $"{unformattedValue}", }; 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 a8ae61de28..26a5c69763 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 @@  - netcoreapp3.1 + net5.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/Microsoft.PowerToys.Run.Plugin.Service.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/Microsoft.PowerToys.Run.Plugin.Service.csproj index 966ee3723d..27641552e2 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 @@ - netcoreapp3.1 + net5.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.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 e4da41be4c..8f10db8628 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 @@  - netcoreapp3.1 + net5.0-windows false x64 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 fbd094c28c..4115690563 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 @@ -1,9 +1,9 @@ - + Library - netcoreapp3.1 + net5.0-windows Properties Microsoft.PowerToys.Run.Plugin.System Microsoft.PowerToys.Run.Plugin.System diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/ResultHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/ResultHelper.cs index 16859bf70a..73023e1431 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/ResultHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/ResultHelper.cs @@ -107,7 +107,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper if (command.Contains(' ')) { var commandSplit = command.Split(' '); - var file = commandSplit.FirstOrDefault(); + var file = commandSplit.FirstOrDefault() ?? string.Empty; var arguments = command[file.Length..].TrimStart(); processStartInfo = new ProcessStartInfo(file, arguments) diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/UnsupportedSettingsHelper.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/UnsupportedSettingsHelper.cs index 713c59b41d..6117381719 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/UnsupportedSettingsHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/UnsupportedSettingsHelper.cs @@ -64,7 +64,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper /// A registry value or on error. private static uint GetNumericRegistryValue(in string registryKey, in string valueName) { - object registryValueData; + object? registryValueData; try { 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 a60d4f0ce0..a7ff279067 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 @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.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.PowerToys.Run.Plugin.WindowsTerminal.UnitTests.csproj b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests.csproj index 8b0f150129..ba66b3a496 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests.csproj +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests/Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0-windows10.0.18362.0 x64 true false @@ -9,8 +9,8 @@ - - + + diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Helpers/TerminalQuery.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Helpers/TerminalQuery.cs index 4a6a26db3e..fb82492d4b 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Helpers/TerminalQuery.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/Helpers/TerminalQuery.cs @@ -8,6 +8,8 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Security.Principal; +using System.Threading; +using Windows.Foundation; using Windows.Management.Deployment; namespace Microsoft.PowerToys.Run.Plugin.WindowsTerminal.Helpers @@ -54,7 +56,13 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsTerminal.Helpers foreach (var p in _packageManager.FindPackagesForUser(user.Value).Where(p => Packages.Contains(p.Id.Name))) { - var aumid = p.GetAppListEntries().Single().AppUserModelId; + var appListEntries = p.GetAppListEntriesAsync(); + while (appListEntries.Status != AsyncStatus.Completed) + { + Thread.Sleep(100); + } + + var aumid = appListEntries.GetResults().Single().AppUserModelId; var version = new Version(p.Id.Version.Major, p.Id.Version.Minor, p.Id.Version.Build, p.Id.Version.Revision); var settingsPath = Path.Combine(localAppDataPath, "Packages", p.Id.FamilyName, "LocalState", "settings.json"); yield return new TerminalPackage(aumid, version, p.DisplayName, settingsPath, p.Logo.LocalPath); 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 215a99e24f..738b5d811f 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 @@ - netcoreapp3.1 + net5.0-windows10.0.18362.0 Microsoft.PowerToys.Run.Plugin.WindowsTerminal Microsoft.PowerToys.Run.Plugin.WindowsTerminal $(Version).0 @@ -38,10 +38,6 @@ true - - - - diff --git a/src/modules/launcher/PowerLauncher/App.xaml.cs b/src/modules/launcher/PowerLauncher/App.xaml.cs index 35f4f606f3..ddb31eb437 100644 --- a/src/modules/launcher/PowerLauncher/App.xaml.cs +++ b/src/modules/launcher/PowerLauncher/App.xaml.cs @@ -46,7 +46,7 @@ namespace PowerLauncher [STAThread] public static void Main() { - Log.Info($"Starting PowerToys Run with PID={Process.GetCurrentProcess().Id}", typeof(App)); + Log.Info($"Starting PowerToys Run with PID={Environment.ProcessId}", typeof(App)); int powerToysPid = GetPowerToysPId(); if (powerToysPid != 0) { diff --git a/src/modules/launcher/PowerLauncher/Helper/LauncherNotificationActivator.cs b/src/modules/launcher/PowerLauncher/Helper/LauncherNotificationActivator.cs deleted file mode 100644 index 54036880bd..0000000000 --- a/src/modules/launcher/PowerLauncher/Helper/LauncherNotificationActivator.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using Microsoft.Toolkit.Uwp.Notifications; - -namespace PowerLauncher.Helper -{ - [ClassInterface(ClassInterfaceType.None)] -#pragma warning disable CS0618 // Type or member is obsolete - [ComSourceInterfaces(typeof(INotificationActivationCallback))] -#pragma warning restore CS0618 // Type or member is obsolete - [Guid("DD5CACDA-7C2E-4997-A62A-04A597B58F76")] - [ComVisible(true)] - public class LauncherNotificationActivator : NotificationActivator - { - public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId) - { - } - } -} diff --git a/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs b/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs index fb5fa98638..f5741b614e 100644 --- a/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs +++ b/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs @@ -116,7 +116,7 @@ namespace PowerLauncher.Helper // get current active window IntPtr hWnd = NativeMethods.GetForegroundWindow(); - if (hWnd != null && !hWnd.Equals(IntPtr.Zero)) + if (hWnd != IntPtr.Zero && !hWnd.Equals(IntPtr.Zero)) { // if current active window is NOT desktop or shell if (!(hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL))) @@ -144,7 +144,7 @@ namespace PowerLauncher.Helper { IntPtr hWndDesktop = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null); hWndDesktop = NativeMethods.FindWindowEx(hWndDesktop, IntPtr.Zero, "SysListView32", "FolderView"); - if (hWndDesktop != null && !hWndDesktop.Equals(IntPtr.Zero)) + if (hWndDesktop != IntPtr.Zero && !hWndDesktop.Equals(IntPtr.Zero)) { return false; } diff --git a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj index c50ad823a1..ad6eb06765 100644 --- a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj +++ b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj @@ -1,9 +1,9 @@ - + PowerToys.Run WinExe - netcoreapp3.1 + net5.0-windows10.0.18362.0 true true PowerLauncher.App @@ -100,7 +100,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml index f21cb17210..0f2d437f04 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 - netcoreapp3.1 + net5.0-windows10.0.18362.0 $(PowerToysRoot)\$(Platform)\$(Configuration)\modules\launcher win-$(Platform) false diff --git a/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs b/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs index 3477cb7bb4..5641713bd3 100644 --- a/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs +++ b/src/modules/launcher/PowerLauncher/PublicAPIInstance.cs @@ -38,15 +38,9 @@ namespace Wox _themeManager.ThemeChanged += OnThemeChanged; WebRequest.RegisterPrefix("data", new DataWebRequestFactory()); - DesktopNotificationManagerCompat.RegisterActivator(); - try + ToastNotificationManagerCompat.OnActivated += args => { - DesktopNotificationManagerCompat.RegisterAumidAndComServer("PowerToysRun"); - } - catch (System.UnauthorizedAccessException ex) - { - Log.Exception("Exception calling RegisterAumidAndComServer. Notifications not available.", ex, MethodBase.GetCurrentMethod().DeclaringType); - } + }; } public void ChangeQuery(string query, bool requery = false) @@ -105,7 +99,7 @@ namespace Wox Application.Current.Dispatcher.Invoke(() => { var toast = new ToastNotification(builder.GetToastContent().GetXml()); - DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast); + ToastNotificationManagerCompat.CreateToastNotifier().Show(toast); }); } diff --git a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs index 85302cd4b6..9fdfc4619c 100644 --- a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs +++ b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs @@ -88,7 +88,10 @@ namespace Wox.Infrastructure.Exception sb.AppendLine(); sb.AppendLine("## Assemblies - " + AppDomain.CurrentDomain.FriendlyName); sb.AppendLine(); - foreach (var ass in AppDomain.CurrentDomain.GetAssemblies().OrderBy(o => o.GlobalAssemblyCache ? 50 : 0)) + + // GlobalAssemblyCache - .NET Core and .NET 5 and later: false in all cases. + // Source https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.globalassemblycache?view=net-6.0 + foreach (var ass in AppDomain.CurrentDomain.GetAssemblies()) { sb.Append("* "); sb.Append(ass.FullName); diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs index c6abbcdea6..2f4897ad9a 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs @@ -98,7 +98,10 @@ namespace Wox.Infrastructure.Storage try { +#pragma warning disable SYSLIB0011 // Type or member is obsolete + // See https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide to fix this var t = ((T)binaryFormatter.Deserialize(stream)).NonNull(); +#pragma warning restore SYSLIB0011 // Type or member is obsolete return t; } catch (System.Exception e) @@ -141,7 +144,10 @@ namespace Wox.Infrastructure.Storage try { +#pragma warning disable SYSLIB0011 // Type or member is obsolete + // See https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide to fix this binaryFormatter.Serialize(stream, data); +#pragma warning restore SYSLIB0011 // Type or member is obsolete } catch (SerializationException e) { diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj index eb3e3f9a34..e75b0a3751 100644 --- a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.0-windows {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3} Library true diff --git a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj index b8a2e0e208..e16bba8a8d 100644 --- a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj +++ b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj @@ -1,8 +1,8 @@ - + - netcoreapp3.1 + net5.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 55e4fa4814..f323d9422b 100644 --- a/src/modules/launcher/Wox.Test/Wox.Test.csproj +++ b/src/modules/launcher/Wox.Test/Wox.Test.csproj @@ -1,8 +1,8 @@  - - + + - netcoreapp3.1 + net5.0-windows10.0.18362.0 {FF742965-9A80-41A5-B042-D6C7D3A21708} Library Properties @@ -61,8 +61,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - + + @@ -80,4 +80,4 @@ all - \ No newline at end of file + diff --git a/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj b/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj index 54839ede71..b4776aca3a 100644 --- a/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj +++ b/src/modules/previewpane/GcodePreviewHandler/GcodePreviewHandler.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -24,7 +24,7 @@ {805306FF-A562-4415-8DEF-E493BDC45918} Microsoft.PowerToys.PreviewHandler.Gcode - netcoreapp3.1 + net5.0-windows10.0.18362.0 true $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ @@ -63,13 +63,6 @@ - - - $(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\10.0.18362.0\Windows.winmd - true - - - ResXFileCodeGenerator diff --git a/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj b/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj index c1b59e1a09..6fc140e863 100644 --- a/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj +++ b/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -10,7 +10,7 @@ Microsoft Corporation Copyright (C) 2020 Microsoft Corporation PowerToys - netcoreapp3.1 + net5.0-windows true true Microsoft Corporation diff --git a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj index 17cbf897b2..5d4361aa1a 100644 --- a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj +++ b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -23,7 +23,7 @@ {6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB} Microsoft.PowerToys.PreviewHandler.Markdown - netcoreapp3.1 + net5.0-windows true $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ PowerToys.MarkdownPreviewHandler diff --git a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj index d62738b88c..70d1490488 100644 --- a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj +++ b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandler.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -23,7 +23,7 @@ {69E1EE8D-143A-4060-9129-4658ACF14AAF} Microsoft.PowerToys.PreviewHandler.Pdf - netcoreapp3.1 + net5.0-windows10.0.18362.0 true $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ PowerToys.PdfPreviewHandler @@ -49,7 +49,6 @@ all - @@ -62,11 +61,4 @@ - - - - $(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\10.0.18362.0\Windows.winmd - true - - \ No newline at end of file diff --git a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandlerControl.cs b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandlerControl.cs index 8e17d9811b..65e4fffb39 100644 --- a/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandlerControl.cs +++ b/src/modules/previewpane/PdfPreviewHandler/PdfPreviewHandlerControl.cs @@ -207,7 +207,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Pdf /// An object of type private Image PageToImage(PdfPage page) { - Image imageOfPage; + Image imageOfPage = null; using (var stream = new InMemoryRandomAccessStream()) { diff --git a/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj b/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj index 51632a6553..3ceb50d7ee 100644 --- a/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj +++ b/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -10,7 +10,7 @@ Microsoft Corporation Copyright (C) 2020 Microsoft Corporation PowerToys - netcoreapp3.1 + net5.0-windows10.0.18362.0 true true Microsoft Corporation @@ -46,7 +46,6 @@ all - @@ -60,12 +59,5 @@ StyleCop.json - - - - $(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\10.0.18362.0\Windows.winmd - true - - \ No newline at end of file diff --git a/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj b/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj index 617281f235..8e9a5d8013 100644 --- a/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj +++ b/src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -24,7 +24,7 @@ {DA425894-6E13-404F-8DCB-78584EC0557A} Microsoft.PowerToys.PreviewHandler.Svg - netcoreapp3.1 + net5.0-windows true $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ PowerToys.SvgPreviewHandler diff --git a/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj b/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj index 99bfa01d2e..57a128dce6 100644 --- a/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj +++ b/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -10,7 +10,7 @@ Microsoft Corporation Copyright (C) 2020 Microsoft Corporation PowerToys - netcoreapp3.1 + net5.0-windows true true Microsoft Corporation diff --git a/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj b/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj index 1248844236..d81146a0a1 100644 --- a/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-GcodePreviewHandler/UnitTests-GcodePreviewHandler.csproj @@ -13,11 +13,11 @@ PowerToys UnitTests-GcodePreviewHandler Copyright (C) 2020 Microsoft Corp. - + {FCF3E52D-B80A-4FC3-98FD-6391354F0EE3} PdfPreviewHandlerUnitTests - netcoreapp3.1 + net5.0-windows10.0.18362.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages @@ -29,7 +29,7 @@ - + @@ -38,8 +38,8 @@ all - - + + @@ -61,4 +61,4 @@ all - \ No newline at end of file + diff --git a/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj index c99086e405..35a7a44163 100644 --- a/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-GcodeThumbnailProvider/UnitTests-GcodeThumbnailProvider.csproj @@ -17,7 +17,7 @@ {133281D8-1BCE-4D07-B31E-796612A9609E} GcodeThumbnailProviderUnitTests - netcoreapp3.1 + net5.0-windows10.0.18362.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages @@ -49,8 +49,8 @@ all - - + + all @@ -75,4 +75,4 @@ Always - \ No newline at end of file + diff --git a/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj b/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj index 7637b96439..f9c99ca819 100644 --- a/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/UnitTests-MarkdownPreviewHandler.csproj @@ -18,7 +18,7 @@ {A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A} PreviewPaneUnitTests PreviewPaneUnitTests - netcoreapp3.1 + net5.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-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj b/src/modules/previewpane/UnitTests-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj index c2ba7b72c0..e8a6478483 100644 --- a/src/modules/previewpane/UnitTests-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-PdfPreviewHandler/UnitTests-PdfPreviewHandler.csproj @@ -13,11 +13,11 @@ PowerToys UnitTests-PdfPreviewHandler Copyright (C) 2020 Microsoft Corp. - + {ECC20689-002A-4354-95A6-B58DF089C6FF} PdfPreviewHandlerUnitTests - netcoreapp3.1 + net5.0-windows10.0.18362.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages @@ -31,7 +31,7 @@ - + @@ -40,8 +40,8 @@ all - - + + @@ -63,4 +63,4 @@ all - \ No newline at end of file + diff --git a/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj index c6360e675a..145743d86b 100644 --- a/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-PdfThumbnailProvider/UnitTests-PdfThumbnailProvider.csproj @@ -13,24 +13,24 @@ PowerToys UnitTests-PdfThumbnailProvider Copyright (C) 2021 Microsoft Corporation - + {F40C3397-1834-4530-B2D9-8F8B8456BCDF} PdfThumbnailProviderUnitTests - netcoreapp3.1 + net5.0-windows10.0.18362.0 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages False UnitTest - + - + - + @@ -49,8 +49,8 @@ all - - + + all @@ -75,4 +75,4 @@ Always - \ No newline at end of file + diff --git a/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj b/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj index e8e68177b8..d56cc46338 100644 --- a/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj +++ b/src/modules/previewpane/UnitTests-PreviewHandlerCommon/UnitTests-PreviewHandlerCommon.csproj @@ -17,7 +17,7 @@ {748417CA-F17E-487F-9411-CAFB6D3F4877} PreviewHandlerCommonUnitTests - netcoreapp3.1 + net5.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-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj b/src/modules/previewpane/UnitTests-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj index 2527c5cdf7..dd34316deb 100644 --- a/src/modules/previewpane/UnitTests-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj +++ b/src/modules/previewpane/UnitTests-SvgPreviewHandler/UnitTests-SvgPreviewHandler.csproj @@ -17,7 +17,7 @@ {060D75DA-2D1C-48E6-A4A1-6F0718B64661} SvgPreviewHandlerUnitTests - netcoreapp3.1 + net5.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-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj b/src/modules/previewpane/UnitTests-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj index 19f4f808d7..8386e6ab0b 100644 --- a/src/modules/previewpane/UnitTests-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj +++ b/src/modules/previewpane/UnitTests-SvgThumbnailProvider/UnitTests-SvgThumbnailProvider.csproj @@ -17,7 +17,7 @@ {1EF1EEF0-10F0-4F2E-8550-39B6D8044D3E} SvgThumbnailProviderUnitTests - netcoreapp3.1 + net5.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/common/PreviewHandlerCommon.csproj b/src/modules/previewpane/common/PreviewHandlerCommon.csproj index f8133f7723..8858a18176 100644 --- a/src/modules/previewpane/common/PreviewHandlerCommon.csproj +++ b/src/modules/previewpane/common/PreviewHandlerCommon.csproj @@ -1,4 +1,4 @@ - + x64 true @@ -22,7 +22,7 @@ {AF2349B8-E5B6-4004-9502-687C1C7730B1} - netcoreapp3.1 + net5.0-windows $(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\ PowerToys.PreviewHandlerCommon