From ae6da3235b3ed98b2cdc0fe21efa397eb3c39f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pol=C3=A1=C5=A1ek?= Date: Mon, 20 Oct 2025 18:56:55 +0200 Subject: [PATCH] CmdPal: Cleanup warnings, part 1 (#42584) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary of the Pull Request This PR fixes several warnings in the Command Palette projects. - _MSB4011_: `"Sdk.props" cannot be imported again. It was already imported ...` - Removed the `Sdk` attribute from `CoreCommonProps.props`. - _CsWinRT1028_ – “Class should be marked partial” on *CsWin32*-generated classes. - Since these classes cannot be made partial, a suppression attribute has been added. - The `LocalKeyboardListener` type has been marked as partial. - _Resource.resx_ – some strings had empty values. - Updated the missing content. - _WMC1506_ – *OneWay* bindings require at least one step to support change notifications. - In `SettingsWindow.xaml`, the breadcrumb binding was changed from *OneWay* to *OneTime*, as `Crumb` does not support change notifications. - _WMC0001_ – Unknown type in XML namespace - In `SettingsWindow.xaml`, `FontWeight` was qualified with the CLR namespace `Windows.UI.Text`. ## PR Checklist - [x] Related to: #42574 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --- src/modules/cmdpal/CoreCommonProps.props | 2 +- .../Helpers/LocalKeyboardListener.cs | 2 +- .../cmdpal/Microsoft.CmdPal.UI/LocalSuppressions.cs | 9 +++++++++ .../Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml | 5 +++-- .../ext/Microsoft.CmdPal.Ext.Apps/LocalSuppressions.cs | 6 ++++++ .../Properties/Resources.Designer.cs | 10 +++++----- .../Properties/Resources.resx | 10 +++++----- .../Microsoft.CmdPal.Ext.Shell/LocalSuppressions.cs | 6 ++++++ 8 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 src/modules/cmdpal/Microsoft.CmdPal.UI/LocalSuppressions.cs create mode 100644 src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/LocalSuppressions.cs create mode 100644 src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/LocalSuppressions.cs diff --git a/src/modules/cmdpal/CoreCommonProps.props b/src/modules/cmdpal/CoreCommonProps.props index 4c30d3f268..aa091d435e 100644 --- a/src/modules/cmdpal/CoreCommonProps.props +++ b/src/modules/cmdpal/CoreCommonProps.props @@ -1,4 +1,4 @@ - + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Helpers/LocalKeyboardListener.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Helpers/LocalKeyboardListener.cs index c3dd7c28bf..788127a5d1 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Helpers/LocalKeyboardListener.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Helpers/LocalKeyboardListener.cs @@ -14,7 +14,7 @@ namespace Microsoft.CmdPal.UI.Helpers; /// /// A class that listens for local keyboard events using a Windows hook. /// -internal sealed class LocalKeyboardListener : IDisposable +internal sealed partial class LocalKeyboardListener : IDisposable { /// /// Event that is raised when a key is pressed down. diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/LocalSuppressions.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/LocalSuppressions.cs new file mode 100644 index 0000000000..1b456f66d7 --- /dev/null +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/LocalSuppressions.cs @@ -0,0 +1,9 @@ +// 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.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Interoperability", "CsWinRT1028: Class should be marked partial", Justification = "CsWin32 generated code; not used across WinRT boundary", Scope = "type", Target = "~T:Windows.Win32.DestroyIconSafeHandle")] +[assembly: SuppressMessage("Interoperability", "CsWinRT1028: Class should be marked partial", Justification = "CsWin32 generated code; not used across WinRT boundary", Scope = "type", Target = "~T:Windows.Win32.DestroyMenuSafeHandle")] +[assembly: SuppressMessage("Interoperability", "CsWinRT1028: Class should be marked partial", Justification = "CsWin32 generated code; not used across WinRT boundary", Scope = "type", Target = "~T:Windows.Win32.FreeLibrarySafeHandle")] +[assembly: SuppressMessage("Interoperability", "CsWinRT1028: Class should be marked partial", Justification = "CsWin32 generated code; not used across WinRT boundary", Scope = "type", Target = "~T:Windows.Win32.UnhookWindowsHookExSafeHandle")] diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml index e4acb05ae1..7eb6b28f88 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml @@ -6,6 +6,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Microsoft.CmdPal.UI.Settings" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:text="using:Windows.UI.Text" xmlns:ui="using:CommunityToolkit.WinUI" xmlns:winuiex="using:WinUIEx" Title="SettingsWindow" @@ -73,14 +74,14 @@ ItemsSource="{x:Bind BreadCrumbs, Mode=OneWay}"> - + 28 7,4,8,0 - SemiBold + SemiBold 16 diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/LocalSuppressions.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/LocalSuppressions.cs new file mode 100644 index 0000000000..87a0cf5673 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/LocalSuppressions.cs @@ -0,0 +1,6 @@ +// 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.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Interoperability", "CsWinRT1028: Class should be marked partial", Justification = "CsWin32 generated code; not used across WinRT boundary", Scope = "type", Target = "~T:Windows.Win32.SysFreeStringSafeHandle")] diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.Designer.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.Designer.cs index cda1f6ccfc..f8695cae1b 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.Designer.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -187,7 +187,7 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Properties { } /// - /// Looks up a localized string similar to . + /// Looks up a localized string similar to Show a confirmation dialog when manually deleting an item. /// public static string settings_confirm_delete_description { get { @@ -196,7 +196,7 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Properties { } /// - /// Looks up a localized string similar to Show a confirmation dialog when manually deleting an item. + /// Looks up a localized string similar to Ask for confirmation before deleting items. /// public static string settings_confirm_delete_title { get { @@ -205,7 +205,7 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Properties { } /// - /// Looks up a localized string similar to . + /// Looks up a localized string similar to Keep items in clipboard history after pasting. /// public static string settings_keep_after_paste_description { get { @@ -214,7 +214,7 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Properties { } /// - /// Looks up a localized string similar to Keep items in clipboard history after pasting. + /// Looks up a localized string similar to Keep items after pasting. /// public static string settings_keep_after_paste_title { get { diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.resx b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.resx index 0af6ee4cfc..56d0805871 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.resx +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Properties/Resources.resx @@ -151,16 +151,16 @@ Deleted from clipboard history - - - Keep items in clipboard history after pasting + + Keep items after pasting + - Show a confirmation dialog when manually deleting an item + Ask for confirmation before deleting items - + Show a confirmation dialog when manually deleting an item Delete item? diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/LocalSuppressions.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/LocalSuppressions.cs new file mode 100644 index 0000000000..dc699880c9 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/LocalSuppressions.cs @@ -0,0 +1,6 @@ +// 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.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Interoperability", "CsWinRT1028: Class should be marked partial", Justification = "CsWin32 generated code; not used across WinRT boundary", Scope = "type", Target = "~T:Windows.Win32.LocalFreeSafeHandle")]