diff --git a/.pipelines/v2/ci.yml b/.pipelines/v2/ci.yml index a68de324ee..0b8daa76d6 100644 --- a/.pipelines/v2/ci.yml +++ b/.pipelines/v2/ci.yml @@ -37,6 +37,10 @@ parameters: type: boolean displayName: "Run Tests" default: true + - name: useVSPreview + type: boolean + displayName: "Build Using Visual Studio Preview" + default: false extends: template: templates/pipeline-ci-build.yml @@ -44,3 +48,4 @@ extends: buildPlatforms: ${{ parameters.buildPlatforms }} enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }} runTests: ${{ parameters.runTests }} + useVSPreview: ${{ parameters.useVSPreview }} diff --git a/.pipelines/v2/release.yml b/.pipelines/v2/release.yml index 2719777aa6..7a5b29c1d4 100644 --- a/.pipelines/v2/release.yml +++ b/.pipelines/v2/release.yml @@ -33,6 +33,11 @@ parameters: - x64 - arm64 + - name: useVSPreview + type: boolean + displayName: "Build Using Visual Studio Preview" + default: false + name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) extends: @@ -42,7 +47,10 @@ extends: - 1ES.PT.ViaStartRight pool: name: SHINE-INT-S - image: SHINE-VS17-Latest + ${{ if eq(parameters.useVSPreview, true) }}: + demands: ImageOverride -equals SHINE-VS17-Preview + ${{ else }}: + image: SHINE-VS17-Latest os: windows sdl: tsa: @@ -58,7 +66,10 @@ extends: parameters: pool: name: SHINE-INT-L - image: SHINE-VS17-Latest + ${{ if eq(parameters.useVSPreview, true) }}: + demands: ImageOverride -equals SHINE-VS17-Preview + ${{ else }}: + image: SHINE-VS17-Latest os: windows variables: IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations diff --git a/.pipelines/v2/templates/job-build-project.yml b/.pipelines/v2/templates/job-build-project.yml index 2a7acc2bdd..1933b74e8d 100644 --- a/.pipelines/v2/templates/job-build-project.yml +++ b/.pipelines/v2/templates/job-build-project.yml @@ -50,7 +50,9 @@ parameters: - name: runTests type: boolean default: true - + - name: useVSPreview + type: boolean + default: false - name: versionNumber type: string default: '0.0.1' @@ -135,7 +137,7 @@ jobs: - template: steps-ensure-dotnet-version.yml parameters: sdk: true - version: '8.0' + version: '9.0' - ${{ if eq(parameters.runTests, true) }}: - task: VisualStudioTestPlatformInstaller@1 @@ -181,6 +183,9 @@ jobs: - pwsh: |- & "$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1" displayName: Work around DD-1541167 (VCToolsVersion) + ${{ if eq(parameters.useVSPreview, true) }}: + env: + VCWhereExtraVersionTarget: '-prerelease' - pwsh: |- & "$(build.sourcesdirectory)\.pipelines\installWiX.ps1" @@ -228,7 +233,10 @@ jobs: inputs: solution: '**\HostsUILib.csproj' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog + ${{ if eq(parameters.useVSPreview, true) }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog /p:NoWarn=NU5104 + ${{ else }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog configuration: $(BuildConfiguration) msbuildArchitecture: x64 maximumCpuCount: true @@ -241,7 +249,10 @@ jobs: inputs: solution: '**\EnvironmentVariablesUILib.csproj' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog + ${{ if eq(parameters.useVSPreview, true) }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog /p:NoWarn=NU5104 + ${{ else }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog configuration: $(BuildConfiguration) msbuildArchitecture: x64 maximumCpuCount: true @@ -254,7 +265,10 @@ jobs: inputs: solution: '**\RegistryPreviewUILib.csproj' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog + ${{ if eq(parameters.useVSPreview, true) }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog /p:NoWarn=NU5104 + ${{ else }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog configuration: $(BuildConfiguration) msbuildArchitecture: x64 maximumCpuCount: true diff --git a/.pipelines/v2/templates/job-test-project.yml b/.pipelines/v2/templates/job-test-project.yml index f5167ededd..212dbeccd8 100644 --- a/.pipelines/v2/templates/job-test-project.yml +++ b/.pipelines/v2/templates/job-test-project.yml @@ -45,7 +45,7 @@ jobs: - template: steps-ensure-dotnet-version.yml parameters: sdk: true - version: '8.0' + version: '9.0' - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform diff --git a/.pipelines/v2/templates/pipeline-ci-build.yml b/.pipelines/v2/templates/pipeline-ci-build.yml index 5410cd030b..71ebd6a33b 100644 --- a/.pipelines/v2/templates/pipeline-ci-build.yml +++ b/.pipelines/v2/templates/pipeline-ci-build.yml @@ -19,6 +19,9 @@ parameters: - name: runTests type: boolean default: true + - name: useVSPreview + type: boolean + default: false stages: # Allow manual builds to skip pre-check @@ -43,12 +46,15 @@ stages: name: SHINE-INT-L ${{ else }}: name: SHINE-OSS-L + ${{ if eq(parameters.useVSPreview, true) }}: + demands: ImageOverride -equals SHINE-VS17-Preview buildPlatforms: - ${{ platform }} buildConfigurations: [Release] enablePackageCaching: true enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }} runTests: ${{ parameters.runTests }} + useVSPreview: ${{ parameters.useVSPreview }} - ${{ if eq(parameters.runTests, true) }}: - stage: Test_${{ platform }} diff --git a/.pipelines/v2/templates/steps-ensure-dotnet-version.yml b/.pipelines/v2/templates/steps-ensure-dotnet-version.yml index ee688d18f6..c3204d065a 100644 --- a/.pipelines/v2/templates/steps-ensure-dotnet-version.yml +++ b/.pipelines/v2/templates/steps-ensure-dotnet-version.yml @@ -1,7 +1,7 @@ parameters: - name: version type: string - default: "8.0" + default: "9.0" - name: sdk type: boolean default: false diff --git a/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 b/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 index 3d140a6c9b..6527b63574 100644 --- a/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 +++ b/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 @@ -1,4 +1,4 @@ -$LatestVCToolsVersion = (([xml](& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -include packages -format xml)).instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.CRT.Source" }).version; +$LatestVCToolsVersion = (([xml](& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest $env:VCWhereExtraVersionTarget -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -include packages -format xml)).instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.CRT.Source" }).version; Write-Output "Latest VCToolsVersion: $LatestVCToolsVersion" Write-Output "Updating VCToolsVersion environment variable for job" diff --git a/Directory.Packages.props b/Directory.Packages.props index 0bef2840b1..a0d29eb311 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -26,19 +26,19 @@ - - + + - - - - - + + + + + - - + + - + - - - + + + - + - - + + - + - - - - + + + + @@ -94,4 +94,4 @@ - + \ No newline at end of file diff --git a/NOTICE.md b/NOTICE.md index 26869867bf..e22705e254 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1318,18 +1318,18 @@ EXHIBIT A -Mozilla Public License. - Mages 2.0.2 - Markdig.Signed 0.34.0 - MessagePack 2.5.187 -- Microsoft.CodeAnalysis.NetAnalyzers 8.0.0 -- Microsoft.Data.Sqlite 8.0.7 +- Microsoft.CodeAnalysis.NetAnalyzers 9.0.0-preview.24508.2 +- Microsoft.Data.Sqlite 9.0.0 - Microsoft.Diagnostics.Tracing.TraceEvent 3.1.16 -- Microsoft.Extensions.DependencyInjection 8.0.0 -- Microsoft.Extensions.Hosting 8.0.0 -- Microsoft.Extensions.Hosting.WindowsServices 8.0.0 -- Microsoft.Extensions.Logging 8.0.0 -- Microsoft.Extensions.Logging.Abstractions 8.0.0 +- Microsoft.Extensions.DependencyInjection 9.0.0 +- Microsoft.Extensions.Hosting 9.0.0 +- Microsoft.Extensions.Hosting.WindowsServices 9.0.0 +- Microsoft.Extensions.Logging 9.0.0 +- Microsoft.Extensions.Logging.Abstractions 9.0.0 - Microsoft.Toolkit.Uwp.Notifications 7.1.2 - Microsoft.Web.WebView2 1.0.2739.15 -- Microsoft.Win32.SystemEvents 8.0.0 -- Microsoft.Windows.Compatibility 8.0.10 +- Microsoft.Win32.SystemEvents 9.0.0 +- Microsoft.Windows.Compatibility 9.0.0 - Microsoft.Windows.CsWin32 0.2.46-beta - Microsoft.Windows.CsWinRT 2.1.5 - Microsoft.Windows.SDK.BuildTools 10.0.22621.2428 @@ -1346,23 +1346,23 @@ EXHIBIT A -Mozilla Public License. - SharpCompress 0.37.2 - StreamJsonRpc 2.19.27 - StyleCop.Analyzers 1.2.0-beta.556 -- System.CodeDom 8.0.0 +- System.CodeDom 9.0.0 - System.CommandLine 2.0.0-beta4.22272.1 -- System.ComponentModel.Composition 8.0.0 -- System.Configuration.ConfigurationManager 8.0.1 -- System.Data.OleDb 8.0.1 +- System.ComponentModel.Composition 9.0.0 +- System.Configuration.ConfigurationManager 9.0.0 +- System.Data.OleDb 9.0.0 - System.Data.SqlClient 4.8.6 -- System.Diagnostics.EventLog 8.0.1 -- System.Diagnostics.PerformanceCounter 8.0.1 -- System.Drawing.Common 8.0.7 +- System.Diagnostics.EventLog 9.0.0 +- System.Diagnostics.PerformanceCounter 9.0.0 +- System.Drawing.Common 9.0.0 - System.IO.Abstractions 21.0.29 - System.IO.Abstractions.TestingHelpers 21.0.29 -- System.Management 8.0.0 +- System.Management 9.0.0 - System.Reactive 6.0.1 -- System.Runtime.Caching 8.0.1 -- System.ServiceProcess.ServiceController 8.0.1 -- System.Text.Encoding.CodePages 8.0.0 -- System.Text.Json 8.0.5 +- System.Runtime.Caching 9.0.0 +- System.ServiceProcess.ServiceController 9.0.0 +- System.Text.Encoding.CodePages 9.0.0 +- System.Text.Json 9.0.0 - UnicodeInformation 2.6.0 - UnitsNet 5.56.0 - UTF.Unknown 2.5.1 diff --git a/src/Common.Dotnet.CsWinRT.props b/src/Common.Dotnet.CsWinRT.props index 1669cba196..41e1bcfcbf 100644 --- a/src/Common.Dotnet.CsWinRT.props +++ b/src/Common.Dotnet.CsWinRT.props @@ -3,7 +3,7 @@ 10.0.22621.48 - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 win-x64;win-arm64 @@ -14,7 +14,7 @@ 4 True - CA1720 + CA1720;CA1859;CA2263;CA2022 diff --git a/src/common/Common.UI/Common.UI.csproj b/src/common/Common.UI/Common.UI.csproj index 32caca984b..8d19debc3b 100644 --- a/src/common/Common.UI/Common.UI.csproj +++ b/src/common/Common.UI/Common.UI.csproj @@ -4,6 +4,7 @@ true + true PowerToys.Common.UI diff --git a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs index fe60dd7f53..7c64db6478 100644 --- a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs +++ b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs @@ -21,7 +21,7 @@ namespace AdvancedPaste.Settings private readonly SettingsUtils _settingsUtils; private readonly TaskScheduler _taskScheduler; private readonly IFileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new(); + private readonly Lock _loadingSettingsLock = new(); private readonly List _additionalActions; private readonly List _customActions; diff --git a/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml index dc3af21cea..cff222baf4 100644 --- a/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/FileLocksmith/FileLocksmithUI/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration)\WinUI3Apps diff --git a/src/modules/Hosts/Hosts/Settings/UserSettings.cs b/src/modules/Hosts/Hosts/Settings/UserSettings.cs index 483396cbee..3530a3f74b 100644 --- a/src/modules/Hosts/Hosts/Settings/UserSettings.cs +++ b/src/modules/Hosts/Hosts/Settings/UserSettings.cs @@ -20,7 +20,7 @@ namespace Hosts.Settings private readonly SettingsUtils _settingsUtils; private readonly IFileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new object(); + private readonly Lock _loadingSettingsLock = new Lock(); public bool ShowStartupWarning { get; private set; } diff --git a/src/modules/MouseUtils/MouseJumpUI/Helpers/ThrottledActionInvoker.cs b/src/modules/MouseUtils/MouseJumpUI/Helpers/ThrottledActionInvoker.cs index ecd17cfa4c..5153a7dade 100644 --- a/src/modules/MouseUtils/MouseJumpUI/Helpers/ThrottledActionInvoker.cs +++ b/src/modules/MouseUtils/MouseJumpUI/Helpers/ThrottledActionInvoker.cs @@ -3,13 +3,14 @@ // See the LICENSE file in the project root for more information. using System; +using System.Threading; using System.Windows.Threading; namespace MouseJumpUI.Helpers; internal sealed class ThrottledActionInvoker { - private readonly object _invokerLock = new(); + private readonly Lock _invokerLock = new(); private readonly DispatcherTimer _timer; private Action? _actionToRun; diff --git a/src/modules/MouseWithoutBorders/App/Class/Common.Clipboard.cs b/src/modules/MouseWithoutBorders/App/Class/Common.Clipboard.cs index 68f700c3d4..91fdfad11b 100644 --- a/src/modules/MouseWithoutBorders/App/Class/Common.Clipboard.cs +++ b/src/modules/MouseWithoutBorders/App/Class/Common.Clipboard.cs @@ -368,7 +368,7 @@ namespace MouseWithoutBorders } } - private static readonly object ClipboardThreadOldLock = new(); + private static readonly Lock ClipboardThreadOldLock = new(); private static System.Threading.Thread clipboardThreadOld; internal static void GetRemoteClipboard(string postAction) diff --git a/src/modules/MouseWithoutBorders/App/Class/Common.Log.cs b/src/modules/MouseWithoutBorders/App/Class/Common.Log.cs index df7518fdb5..773564fe7f 100644 --- a/src/modules/MouseWithoutBorders/App/Class/Common.Log.cs +++ b/src/modules/MouseWithoutBorders/App/Class/Common.Log.cs @@ -32,7 +32,7 @@ namespace MouseWithoutBorders { public class Thread { - private static readonly object ThreadsLock = new(); + private static readonly Lock ThreadsLock = new(); private static List threads; private readonly System.Threading.Thread thread; diff --git a/src/modules/MouseWithoutBorders/App/Class/Common.MachineStuff.cs b/src/modules/MouseWithoutBorders/App/Class/Common.MachineStuff.cs index 2088fa0b8f..2072478f2d 100644 --- a/src/modules/MouseWithoutBorders/App/Class/Common.MachineStuff.cs +++ b/src/modules/MouseWithoutBorders/App/Class/Common.MachineStuff.cs @@ -43,7 +43,7 @@ namespace MouseWithoutBorders internal partial class Common { - private static readonly object McMatrixLock = new(); + private static readonly Lock McMatrixLock = new(); internal const byte MAX_MACHINE = 4; internal const byte MAX_SOCKET = MAX_MACHINE * 2; diff --git a/src/modules/MouseWithoutBorders/App/Class/Common.cs b/src/modules/MouseWithoutBorders/App/Class/Common.cs index 1caeb47b2c..f3cf4a86fd 100644 --- a/src/modules/MouseWithoutBorders/App/Class/Common.cs +++ b/src/modules/MouseWithoutBorders/App/Class/Common.cs @@ -474,7 +474,7 @@ namespace MouseWithoutBorders } } - private static readonly object InputSimulationLock = new(); + private static readonly Lock InputSimulationLock = new(); internal static void DoSomethingInTheInputSimulationThread(ThreadStart target) { diff --git a/src/modules/MouseWithoutBorders/App/Class/MachinePool.cs b/src/modules/MouseWithoutBorders/App/Class/MachinePool.cs index 2420e43b37..bfbdc3d1d2 100644 --- a/src/modules/MouseWithoutBorders/App/Class/MachinePool.cs +++ b/src/modules/MouseWithoutBorders/App/Class/MachinePool.cs @@ -10,6 +10,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Threading; namespace MouseWithoutBorders.Class { @@ -36,12 +37,12 @@ namespace MouseWithoutBorders.Class /// internal class MachinePool { - private readonly object @lock; + private readonly Lock @lock; private readonly List list; public MachinePool() { - @lock = new object(); + @lock = new Lock(); list = new List(); } diff --git a/src/modules/MouseWithoutBorders/App/Class/Setting.cs b/src/modules/MouseWithoutBorders/App/Class/Setting.cs index a2eb300b0c..a49b98d4f7 100644 --- a/src/modules/MouseWithoutBorders/App/Class/Setting.cs +++ b/src/modules/MouseWithoutBorders/App/Class/Setting.cs @@ -13,6 +13,7 @@ using System.IO.Abstractions; using System.Linq; using System.Security.Cryptography; using System.Text.Json.Serialization; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -44,7 +45,7 @@ namespace MouseWithoutBorders.Class internal bool Changed; private readonly SettingsUtils _settingsUtils; - private readonly object _loadingSettingsLock = new object(); + private readonly Lock _loadingSettingsLock = new Lock(); private readonly IFileSystemWatcher _watcher; private MouseWithoutBordersProperties _properties; diff --git a/src/modules/MouseWithoutBorders/App/Class/SocketStuff.cs b/src/modules/MouseWithoutBorders/App/Class/SocketStuff.cs index a6cf02e348..6f354e4af1 100644 --- a/src/modules/MouseWithoutBorders/App/Class/SocketStuff.cs +++ b/src/modules/MouseWithoutBorders/App/Class/SocketStuff.cs @@ -826,7 +826,7 @@ namespace MouseWithoutBorders.Class } private static readonly Dictionary> BadIPs = new(); - private static readonly object BadIPsLock = new(); + private static readonly Lock BadIPsLock = new(); private static bool IsBadIP(string machineName, IPAddress ip) { diff --git a/src/modules/MouseWithoutBorders/App/Control/ColorBorderField.cs b/src/modules/MouseWithoutBorders/App/Control/ColorBorderField.cs index f7fd54e16f..05292e4b64 100644 --- a/src/modules/MouseWithoutBorders/App/Control/ColorBorderField.cs +++ b/src/modules/MouseWithoutBorders/App/Control/ColorBorderField.cs @@ -19,6 +19,7 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("The thickness of the border around the field")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public int BorderSize { get => _borderSize; @@ -33,6 +34,7 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("The color of the border around the field")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Color BorderColor { get => _borderColor; @@ -47,6 +49,7 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("The color of the border around the field when it has focus")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Color FocusColor { get => _focusColor; @@ -59,12 +62,14 @@ namespace MouseWithoutBorders [Category("Behavior")] [Description("The maximum number of characters that can be typed in the field")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public int MaximumLength { get => InnerField.MaxLength; set => InnerField.MaxLength = value; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public override string Text { get => InnerField.Text; diff --git a/src/modules/MouseWithoutBorders/App/Control/ImageButton.cs b/src/modules/MouseWithoutBorders/App/Control/ImageButton.cs index da191ab3c0..c5f939079f 100644 --- a/src/modules/MouseWithoutBorders/App/Control/ImageButton.cs +++ b/src/modules/MouseWithoutBorders/App/Control/ImageButton.cs @@ -19,12 +19,14 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("Image to show when Mouse is pressed on button")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image DownImage { get; set; } private Image _normalImage; [Category("Appearance")] [Description("Image to show when button is in normal state")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image NormalImage { get => _normalImage; @@ -37,10 +39,12 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("Image to show when Mouse hovers over button")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image HoverImage { get; set; } [Category("Appearance")] [Description("Image to show when button is disabled")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image DisabledImage { get; set; } private bool _hovering; diff --git a/src/modules/MouseWithoutBorders/App/Control/ImageRadioButton.cs b/src/modules/MouseWithoutBorders/App/Control/ImageRadioButton.cs index fb1f715e36..5dcbf78fb5 100644 --- a/src/modules/MouseWithoutBorders/App/Control/ImageRadioButton.cs +++ b/src/modules/MouseWithoutBorders/App/Control/ImageRadioButton.cs @@ -16,6 +16,7 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("The bounding rectangle of the check image in local co-ordinates")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Point ImageLocation { get => _imageLocation; @@ -28,6 +29,7 @@ namespace MouseWithoutBorders private Point _textLocation; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Point TextLocation { get => _textLocation; @@ -47,6 +49,7 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("Image to show when Mouse is pressed on button")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image CheckedImage { get => _checkedImage; @@ -61,6 +64,7 @@ namespace MouseWithoutBorders [Category("Appearance")] [Description("Image to show when button is in normal state")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image UncheckedImage { get => _uncheckedImage; diff --git a/src/modules/MouseWithoutBorders/App/Control/Machine.cs b/src/modules/MouseWithoutBorders/App/Control/Machine.cs index c8ce5306ac..c7323b981c 100644 --- a/src/modules/MouseWithoutBorders/App/Control/Machine.cs +++ b/src/modules/MouseWithoutBorders/App/Control/Machine.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.ComponentModel; using System.Windows.Forms; // @@ -34,12 +35,14 @@ namespace MouseWithoutBorders MachineEnabled = false; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal string MachineName { get => textBoxName.Text; set => textBoxName.Text = value; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal bool MachineEnabled { get => checkBoxEnabled.Checked; @@ -52,6 +55,7 @@ namespace MouseWithoutBorders } } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] internal bool Editable { set => textBoxName.Enabled = value; @@ -59,6 +63,7 @@ namespace MouseWithoutBorders // get { return textBoxName.Enabled; } } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] internal bool CheckAble { set @@ -73,6 +78,7 @@ namespace MouseWithoutBorders } } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] internal bool LocalHost { // get { return localhost; } @@ -165,6 +171,7 @@ namespace MouseWithoutBorders return rv; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal SocketStatus StatusClient { get => statusClient; @@ -182,6 +189,7 @@ namespace MouseWithoutBorders } } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal SocketStatus StatusServer { get => statusServer; diff --git a/src/modules/MouseWithoutBorders/App/Core/Logger.cs b/src/modules/MouseWithoutBorders/App/Core/Logger.cs index 8d4c42e373..c6e62139ba 100644 --- a/src/modules/MouseWithoutBorders/App/Core/Logger.cs +++ b/src/modules/MouseWithoutBorders/App/Core/Logger.cs @@ -12,6 +12,7 @@ using System.Net; using System.Net.Sockets; using System.Reflection; using System.Text; +using System.Threading; using System.Windows.Forms; // @@ -30,7 +31,7 @@ namespace MouseWithoutBorders.Core; internal static class Logger { internal static readonly string[] AllLogs = new string[MAX_LOG]; - private static readonly object AllLogsLock = new(); + private static readonly Lock AllLogsLock = new(); internal static readonly ConcurrentDictionary LogCounter = new(); private const int MAX_LOG = 10000; private static int allLogsIndex; diff --git a/src/modules/MouseWithoutBorders/App/Form/Settings/SetupPage3a.cs b/src/modules/MouseWithoutBorders/App/Form/Settings/SetupPage3a.cs index 4c8c3cd2eb..ea5334f3a5 100644 --- a/src/modules/MouseWithoutBorders/App/Form/Settings/SetupPage3a.cs +++ b/src/modules/MouseWithoutBorders/App/Form/Settings/SetupPage3a.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.ComponentModel; using System.Drawing; using System.Windows.Forms; @@ -32,6 +33,7 @@ namespace MouseWithoutBorders private int _animationFrame; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public bool ReturnToSettings { get; set; } public SetupPage3a() diff --git a/src/modules/MouseWithoutBorders/App/Form/frmScreen.cs b/src/modules/MouseWithoutBorders/App/Form/frmScreen.cs index 0df3454d80..027844315d 100644 --- a/src/modules/MouseWithoutBorders/App/Form/frmScreen.cs +++ b/src/modules/MouseWithoutBorders/App/Form/frmScreen.cs @@ -58,12 +58,16 @@ namespace MouseWithoutBorders private Timer helperTimer; #pragma warning restore CA2213 + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal int CurIcon { get; set; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal NotifyIcon NotifyIcon { get; set; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal System.Windows.Forms.ToolStripMenuItem MenuAllPC { get; set; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal System.Windows.Forms.ContextMenuStrip MainMenu { get; set; } internal FrmScreen() diff --git a/src/modules/MouseWithoutBorders/App/Helper/FormHelper.cs b/src/modules/MouseWithoutBorders/App/Helper/FormHelper.cs index 969ba9db37..edbb5347e0 100644 --- a/src/modules/MouseWithoutBorders/App/Helper/FormHelper.cs +++ b/src/modules/MouseWithoutBorders/App/Helper/FormHelper.cs @@ -19,7 +19,7 @@ namespace MouseWithoutBorders public partial class FormHelper : System.Windows.Forms.Form { private readonly List focusZone = new(); - private readonly object bmScreenLock = new(); + private readonly Lock bmScreenLock = new(); private long lastClipboardEventTime; private IClipboardHelper remoteClipboardHelper; diff --git a/src/modules/PowerOCR/PowerOCR/Helpers/ThrottledActionInvoker.cs b/src/modules/PowerOCR/PowerOCR/Helpers/ThrottledActionInvoker.cs index 16059a2584..17f2a0506d 100644 --- a/src/modules/PowerOCR/PowerOCR/Helpers/ThrottledActionInvoker.cs +++ b/src/modules/PowerOCR/PowerOCR/Helpers/ThrottledActionInvoker.cs @@ -4,6 +4,7 @@ using System; using System.ComponentModel.Composition; +using System.Threading; using System.Windows.Threading; namespace PowerOCR.Helpers; @@ -11,7 +12,7 @@ namespace PowerOCR.Helpers; [Export(typeof(IThrottledActionInvoker))] public sealed class ThrottledActionInvoker : IThrottledActionInvoker { - private object _invokerLock = new object(); + private Lock _invokerLock = new Lock(); private Action? _actionToRun; private DispatcherTimer _timer; diff --git a/src/modules/PowerOCR/PowerOCR/Settings/UserSettings.cs b/src/modules/PowerOCR/PowerOCR/Settings/UserSettings.cs index 6d6867eea7..0c57171f3a 100644 --- a/src/modules/PowerOCR/PowerOCR/Settings/UserSettings.cs +++ b/src/modules/PowerOCR/PowerOCR/Settings/UserSettings.cs @@ -24,7 +24,7 @@ namespace PowerOCR.Settings private const int SettingsReadOnChangeDelayInMs = 300; private readonly IFileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new(); + private readonly Lock _loadingSettingsLock = new(); [ImportingConstructor] public UserSettings(Helpers.IThrottledActionInvoker throttledActionInvoker) diff --git a/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs b/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs index 7c9e87f092..f0b7412ee2 100644 --- a/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs +++ b/src/modules/colorPicker/ColorPickerUI/Common/RangeObservableCollection.cs @@ -6,13 +6,14 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; +using System.Threading; namespace ColorPicker.Common { [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "File name is correct, ignore generics")] public sealed class RangeObservableCollection : ObservableCollection { - private object _collectionChangedLock = new object(); + private Lock _collectionChangedLock = new Lock(); private bool _suppressNotification; protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) diff --git a/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs b/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs index 98cf19149e..9b189e893e 100644 --- a/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs +++ b/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs @@ -325,7 +325,7 @@ namespace ColorPicker.Controls private static string ColorToHex(Color color, string oldValue = "") { - string newHexString = BitConverter.ToString(new byte[] { color.R, color.G, color.B }).Replace("-", string.Empty, StringComparison.InvariantCulture); + string newHexString = Convert.ToHexString(new byte[] { color.R, color.G, color.B }); newHexString = newHexString.ToLowerInvariant(); // Return only with hashtag if user typed it before diff --git a/src/modules/colorPicker/ColorPickerUI/Helpers/AppStateHandler.cs b/src/modules/colorPicker/ColorPickerUI/Helpers/AppStateHandler.cs index 6ff1e96205..09d2aa4d54 100644 --- a/src/modules/colorPicker/ColorPickerUI/Helpers/AppStateHandler.cs +++ b/src/modules/colorPicker/ColorPickerUI/Helpers/AppStateHandler.cs @@ -4,6 +4,7 @@ using System; using System.ComponentModel.Composition; +using System.Threading; using System.Windows; using System.Windows.Interop; @@ -23,7 +24,7 @@ namespace ColorPicker.Helpers private readonly IUserSettings _userSettings; private ColorEditorWindow _colorEditorWindow; private bool _colorPickerShown; - private object _colorPickerVisibilityLock = new object(); + private Lock _colorPickerVisibilityLock = new Lock(); private HwndSource _hwndSource; private const int _globalHotKeyId = 0x0001; diff --git a/src/modules/colorPicker/ColorPickerUI/Helpers/ThrottledActionInvoker.cs b/src/modules/colorPicker/ColorPickerUI/Helpers/ThrottledActionInvoker.cs index 16279bd910..0782583ea2 100644 --- a/src/modules/colorPicker/ColorPickerUI/Helpers/ThrottledActionInvoker.cs +++ b/src/modules/colorPicker/ColorPickerUI/Helpers/ThrottledActionInvoker.cs @@ -4,6 +4,7 @@ using System; using System.ComponentModel.Composition; +using System.Threading; using System.Windows.Threading; namespace ColorPicker.Helpers @@ -11,7 +12,7 @@ namespace ColorPicker.Helpers [Export(typeof(IThrottledActionInvoker))] public sealed class ThrottledActionInvoker : IThrottledActionInvoker { - private object _invokerLock = new object(); + private Lock _invokerLock = new Lock(); private Action _actionToRun; private DispatcherTimer _timer; diff --git a/src/modules/colorPicker/ColorPickerUI/Settings/UserSettings.cs b/src/modules/colorPicker/ColorPickerUI/Settings/UserSettings.cs index ba88be2318..eb6a9db7aa 100644 --- a/src/modules/colorPicker/ColorPickerUI/Settings/UserSettings.cs +++ b/src/modules/colorPicker/ColorPickerUI/Settings/UserSettings.cs @@ -33,7 +33,7 @@ namespace ColorPicker.Settings [System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "Actually, call back is LoadSettingsFromJson")] private readonly IFileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new object(); + private readonly Lock _loadingSettingsLock = new Lock(); private bool _loadingColorsHistory; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs index 37a6186fdf..253798429f 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs @@ -21,7 +21,7 @@ namespace Microsoft.Plugin.WindowWalker.Components /// /// Used to enforce single execution of EnumWindows /// - private static readonly object _enumWindowsLock = new(); + private static readonly Lock _enumWindowsLock = new(); /// /// PowerLauncher main executable diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Components/UtilityProvider.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Components/UtilityProvider.cs index 17e1728f98..a953496500 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Components/UtilityProvider.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/Components/UtilityProvider.cs @@ -22,7 +22,7 @@ namespace Microsoft.PowerToys.Run.Plugin.PowerToys private const int MaxNumberOfRetry = 5; private readonly List _utilities; private readonly FileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new(); + private readonly Lock _loadingSettingsLock = new(); private bool _disposed; public UtilityProvider() diff --git a/src/modules/launcher/PowerLauncher/App.xaml.cs b/src/modules/launcher/PowerLauncher/App.xaml.cs index f110bf7142..556f05939b 100644 --- a/src/modules/launcher/PowerLauncher/App.xaml.cs +++ b/src/modules/launcher/PowerLauncher/App.xaml.cs @@ -49,7 +49,7 @@ namespace PowerLauncher private ETWTrace etwTrace = new ETWTrace(); // To prevent two disposals running at the same time. - private static readonly object _disposingLock = new object(); + private static readonly Lock _disposingLock = new Lock(); [STAThread] public static void Main() diff --git a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs index 4cd6c1f15e..24666e3f51 100644 --- a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs +++ b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs @@ -11,6 +11,7 @@ using System.IO.Abstractions; using System.Linq; using System.Reflection; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; @@ -29,7 +30,7 @@ namespace PowerLauncher.Plugin { private static readonly IFileSystem FileSystem = new FileSystem(); private static readonly IDirectory Directory = FileSystem.Directory; - private static readonly object AllPluginsLock = new object(); + private static readonly Lock AllPluginsLock = new Lock(); private static readonly CompositeFormat FailedToInitializePluginsDescription = System.Text.CompositeFormat.Parse(Properties.Resources.FailedToInitializePluginsDescription); diff --git a/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/launcher/PowerLauncher/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 0f90e724bf..026a6d4112 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 - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) diff --git a/src/modules/launcher/PowerLauncher/SettingsReader.cs b/src/modules/launcher/PowerLauncher/SettingsReader.cs index 65cdeb1be1..835ef2bcd4 100644 --- a/src/modules/launcher/PowerLauncher/SettingsReader.cs +++ b/src/modules/launcher/PowerLauncher/SettingsReader.cs @@ -29,7 +29,7 @@ namespace PowerLauncher private readonly SettingsUtils _settingsUtils; private const int MaxRetries = 10; - private static readonly object _readSyncObject = new object(); + private static readonly Lock _readSyncObject = new Lock(); private readonly PowerToysRunSettings _settings; private readonly ThemeManager _themeManager; private Action _refreshPluginsOverviewCallback; @@ -73,7 +73,7 @@ namespace PowerLauncher public void ReadSettings() { - Monitor.Enter(_readSyncObject); + _readSyncObject.Enter(); var retry = true; var retryCount = 0; while (retry) @@ -224,7 +224,7 @@ namespace PowerLauncher } } - Monitor.Exit(_readSyncObject); + _readSyncObject.Exit(); } public void SetRefreshPluginsOverviewCallback(Action callback) diff --git a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs index 5d6c55b46d..da4ec4135d 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs @@ -47,7 +47,7 @@ namespace PowerLauncher.ViewModel private readonly PowerToysRunSettings _settings; private readonly QueryHistory _history; private readonly UserSelectedRecord _userSelectedRecord; - private static readonly object _addResultsLock = new object(); + private static readonly Lock _addResultsLock = new Lock(); private readonly System.Diagnostics.Stopwatch _hotkeyTimer = new System.Diagnostics.Stopwatch(); private string _queryTextBeforeLeaveResults; diff --git a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs index 1afafa23ba..159852035f 100644 --- a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs +++ b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Reflection; +using System.Threading; using Wox.Plugin.Logger; @@ -13,7 +14,7 @@ namespace Wox.Infrastructure public static class Stopwatch { private static readonly Dictionary Count = new Dictionary(); - private static readonly object Locker = new object(); + private static readonly Lock Locker = new Lock(); /// /// This stopwatch will appear only in Debug mode diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs index 72ef561f77..0e399db12b 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs @@ -9,6 +9,7 @@ using System.IO; using System.IO.Abstractions; using System.Linq; using System.Text.Json; +using System.Threading; using Wox.Plugin.Logger; @@ -23,7 +24,7 @@ namespace Wox.Infrastructure.Storage private static readonly IPath Path = FileSystem.Path; private static readonly IFile File = FileSystem.File; - private readonly object _saveLock = new object(); + private readonly Lock _saveLock = new Lock(); // use property initialization instead of DefaultValueAttribute // easier and flexible for default value of object diff --git a/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs b/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs index b816aa9220..64493e23e2 100644 --- a/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs +++ b/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs @@ -4,6 +4,7 @@ using System; using System.Text; +using System.Threading; using Wox.Plugin.Common.Win32; using Wox.Plugin.Logger; @@ -15,7 +16,7 @@ namespace Wox.Plugin.Common /// public static class DefaultBrowserInfo { - private static readonly object _updateLock = new object(); + private static readonly Lock _updateLock = new Lock(); /// Gets the path to the MS Edge browser executable. public static string MSEdgePath => System.IO.Path.Combine( diff --git a/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs b/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs index 40552b4fe4..0952d8149c 100644 --- a/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs +++ b/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs @@ -20,7 +20,7 @@ namespace Peek.FilePreviewer.Models private readonly SettingsUtils _settingsUtils; private readonly IFileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new(); + private readonly Lock _loadingSettingsLock = new(); public bool SourceCodeWrapText { get; private set; } diff --git a/src/modules/peek/Peek.UI/Services/UserSettings.cs b/src/modules/peek/Peek.UI/Services/UserSettings.cs index a0d143c7a9..894df5b8c4 100644 --- a/src/modules/peek/Peek.UI/Services/UserSettings.cs +++ b/src/modules/peek/Peek.UI/Services/UserSettings.cs @@ -20,7 +20,7 @@ namespace Peek.UI private readonly SettingsUtils _settingsUtils; private readonly IFileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new(); + private readonly Lock _loadingSettingsLock = new(); public bool CloseAfterLosingFocus { get; private set; } diff --git a/src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs b/src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs index a745d83bc9..b234fcfde4 100644 --- a/src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs +++ b/src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs @@ -18,7 +18,7 @@ public class SettingsService private const string PowerAccentModuleName = "QuickAccent"; private readonly SettingsUtils _settingsUtils; private readonly IFileSystemWatcher _watcher; - private readonly object _loadingSettingsLock = new object(); + private readonly Lock _loadingSettingsLock = new Lock(); private KeyboardListener _keyboardListener; public SettingsService(KeyboardListener keyboardListener) diff --git a/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj b/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj index 1849810ab1..9073a94931 100644 --- a/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj +++ b/src/modules/previewpane/GcodeThumbnailProvider/GcodeThumbnailProvider.csproj @@ -37,6 +37,7 @@ + \ No newline at end of file diff --git a/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 0f90e724bf..026a6d4112 100644 --- a/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/MarkdownPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) diff --git a/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 0f90e724bf..026a6d4112 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/MonacoPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) diff --git a/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj b/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj index eb838771d6..b3702300c3 100644 --- a/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj +++ b/src/modules/previewpane/PdfThumbnailProvider/PdfThumbnailProvider.csproj @@ -35,6 +35,7 @@ + \ No newline at end of file diff --git a/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj b/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj index 685a183ab9..b12679fad7 100644 --- a/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj +++ b/src/modules/previewpane/QoiThumbnailProvider/QoiThumbnailProvider.csproj @@ -36,6 +36,7 @@ + \ No newline at end of file diff --git a/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 0f90e724bf..026a6d4112 100644 --- a/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/SvgPreviewHandler/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) diff --git a/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml index 0f90e724bf..026a6d4112 100644 --- a/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/modules/previewpane/SvgThumbnailProvider/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration) diff --git a/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs b/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs index a31878f240..4b79045483 100644 --- a/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs +++ b/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs @@ -25,8 +25,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library { private static SettingsBackupAndRestoreUtils instance; private (bool Success, string Severity, bool LastBackupExists, DateTime? LastRan) lastBackupSettingsResults; - private static object backupSettingsInternalLock = new object(); - private static object removeOldBackupsLock = new object(); + private static Lock backupSettingsInternalLock = new Lock(); + private static Lock removeOldBackupsLock = new Lock(); public DateTime LastBackupStartTime { get; set; } @@ -933,7 +933,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library /// private static void RemoveOldBackups(string location, int minNumberToKeep, TimeSpan deleteIfOlderThanTs) { - if (!Monitor.TryEnter(removeOldBackupsLock, 1000)) + if (!removeOldBackupsLock.TryEnter(1000)) { return; } @@ -1002,7 +1002,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library } finally { - Monitor.Exit(removeOldBackupsLock); + removeOldBackupsLock.Exit(); } } diff --git a/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs b/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs index 7f634a2012..136b92b63a 100644 --- a/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs +++ b/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Threading; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; @@ -13,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library public class SettingsRepository : ISettingsRepository where T : class, ISettingsConfig, new() { - private static readonly object _SettingsRepoLock = new object(); + private static readonly Lock _SettingsRepoLock = new Lock(); private static ISettingsUtils _settingsUtils; diff --git a/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml index dc3af21cea..cff222baf4 100644 --- a/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration)\WinUI3Apps diff --git a/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs index a0533d8d63..f5639dba14 100644 --- a/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs @@ -35,7 +35,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private GeneralSettings GeneralSettingsConfig { get; set; } private readonly ISettingsUtils _settingsUtils; - private readonly object _delayedActionLock = new object(); + private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock(); private readonly AdvancedPasteSettings _advancedPasteSettings; private readonly AdvancedPasteAdditionalActions _additionalActions; diff --git a/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs index 4f59ed6e03..bf20e551f2 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs @@ -29,7 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private GeneralSettings GeneralSettingsConfig { get; set; } private readonly ISettingsUtils _settingsUtils; - private readonly object _delayedActionLock = new object(); + private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock(); private readonly ColorPickerSettings _colorPickerSettings; private Timer _delayedTimer; diff --git a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs index 6e71752b30..bf56b312dd 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs @@ -39,7 +39,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels 0, }; - private readonly object _machineMatrixStringLock = new(); + private readonly Lock _machineMatrixStringLock = new(); private static readonly Dictionary StatusColors = new Dictionary() { diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs index 3751f6a377..dc09c2cad9 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs @@ -30,7 +30,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private GeneralSettings GeneralSettingsConfig { get; set; } private readonly ISettingsUtils _settingsUtils; - private readonly object _delayedActionLock = new object(); + private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock(); private readonly PowerOcrSettings _powerOcrSettings; private Timer _delayedTimer;