mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-11-04 12:01:21 +00:00
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Restore Hybrid CRT together with the Runner shutdown fix for the tray-Quit process hang introduced by #50899. Without explicit early cleanup, Runner's static module-map destruction can hold the shared UCRT exit lock while waiting for a module worker that needs that same lock. Main temporarily disabled Hybrid CRT through #51432. This PR now reverses that rollback **in the same change as the shutdown fix**, completing module shutdown before CRT teardown and before releasing Runner's lifetime guards. The rollback reversal must not be merged independently of the fix. The original three commits were rebased onto main `e7afd3fa439906a8e4ff4388a961511ca5cf81e7` without conflicts or patch changes, followed by the exact revert of #51432. The combined fix was validated at `d62d5e004e70a1f8a4eaca7f591fab8bf7eebd8f`; follow-ups remove both `runner.md` changes and the manual shutdown-check script from this PR without changing product code. Stable and the published 0.102 release are not changed. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: N/A; regression introduced by #50899, restoring Hybrid CRT after the mitigation in #51432 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **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 — existing native tests and prior manual shutdown checks passed; no new automated test is retained in this PR, and broader restart/elevation/session-ending runtime coverage remains incomplete - [x] **Localization:** All end-user-facing strings can be localized — no new end-user strings - [x] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places — N/A, no new shipping binaries - [ ] [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: N/A; repository developer documentation only <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments - `src\runner\main.cpp`: a local cleanup guard cancels deferred Settings startup, stops the centralized hook, revokes module hotkey callbacks, and clears the module map before the settings-CLI and single-instance guards are released. It covers ordinary exit and exception unwinding as well as restart; the old restart-only clear is removed. - `src\runner\centralized_hotkeys.cpp`: revoke every matching callback and avoid trying to unregister window-owned hotkeys after their window has been destroyed. - Advanced Paste and PowerDisplay process-manager headers: declare the executor last so its worker joins before the pipe/state accessed by its tasks is destroyed. - `Cpp.Build.props` and `doc\devdocs\development\guidelines.md`: exactly revert `cf45de4118c22dbe80a2aa55c6ea0935ea7e2b3b` (#51432), restoring the shared-UCRT default and its runtime guidance. Existing project-specific CRT choices remain intact. The New+ and logger fixes from #50899 are not reverted. The commit order keeps the shutdown fix before Hybrid CRT is re-enabled. Rebasing already reapplied the fix; it was not duplicated. The final diff against the PR base contains six files. The Runner documentation, new Runner verification profile, and manual shutdown-check script are excluded. Existing Windows session-ending skips for Settings and Quick Access are unchanged. No settings schema, IPC contract, elevation policy, or pipeline changes. The initial diagnosis used matching PDBs on lingering installed 0.102.2883.0 processes and an isolated static/Hybrid CRT linkage experiment. These support the root cause but do not replace runtime validation. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
200 lines
11 KiB
XML
200 lines
11 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project ToolsVersion="4.0"
|
|
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<!-- Skip building C++ test projects when BuildTests=false -->
|
|
<PropertyGroup Condition="'$(_IsSkippedTestProject)' == 'true'">
|
|
<UsePrecompiledHeaders>false</UsePrecompiledHeaders>
|
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
|
</PropertyGroup>
|
|
|
|
<!-- Project configurations -->
|
|
<ItemGroup Label="ProjectConfigurations">
|
|
<ProjectConfiguration Include="Debug|x64">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|x64">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Debug|ARM64">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|ARM64">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
</ItemGroup>
|
|
|
|
<!-- Run code analysis locally and in PR CI, but not on release CI -->
|
|
<PropertyGroup Condition="'$(SkipCppCodeAnalysis)' == ''">
|
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
|
<CodeAnalysisRuleSet>$(MsbuildThisFileDirectory)\CppRuleSet.ruleset</CodeAnalysisRuleSet>
|
|
<CAExcludePath>$(MSBuildThisFileDirectory)deps;$(MSBuildThisFileDirectory)packages;$(CAExcludePath)</CAExcludePath>
|
|
</PropertyGroup>
|
|
|
|
<!-- C++ source compile-specific things for all configurations -->
|
|
<PropertyGroup>
|
|
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
|
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
|
|
<!-- vcpkg.targets is imported via Cpp.Build.targets after Microsoft.Cpp.targets. -->
|
|
<ForceImportAfterCppTargets>$(MSBuildThisFileDirectory)Cpp.Build.targets</ForceImportAfterCppTargets>
|
|
<ReplaceWildcardsInProjectItems>true</ReplaceWildcardsInProjectItems>
|
|
<ExternalIncludePath>$(MSBuildThisFileDirectory)deps;$(MSBuildThisFileDirectory)packages;$(ExternalIncludePath)</ExternalIncludePath>
|
|
<!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
|
|
<!-- This covers the case where a .dll exports a .lib, but doesn't have any ClCompile entries. -->
|
|
<LinkControlFlowGuard>Guard</LinkControlFlowGuard>
|
|
</PropertyGroup>
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<!-- Make angle-bracket includes external and turn off code analysis for them -->
|
|
<TreatAngleIncludeAsExternal>true</TreatAngleIncludeAsExternal>
|
|
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
|
|
<DisableAnalyzeExternal>true</DisableAnalyzeExternal>
|
|
|
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
<PrecompiledHeader Condition="'$(UsePrecompiledHeaders)' != 'false'">Use</PrecompiledHeader>
|
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
<WarningLevel>Level4</WarningLevel>
|
|
<DisableSpecificWarnings>4679;4706;4874;5271;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
|
|
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
|
|
<ConformanceMode>true</ConformanceMode>
|
|
<TreatWarningAsError>true</TreatWarningAsError>
|
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
|
<BuildStlModules>false</BuildStlModules>
|
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
|
<!-- TODO: _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for compatibility with VS 17.8. Check if we can remove. -->
|
|
<!-- TODO: _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS for VS 2026 (MSVC 14.51+). The STL turned
|
|
<experimental/coroutine> into a hard error (STL1011), and C++/WinRT's base.h still falls back to it when
|
|
__cpp_lib_coroutine isn't defined at include time. Remove once C++/WinRT no longer references the experimental header. -->
|
|
<PreprocessorDefinitions>_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<!-- CLR + CFG are not compatible >:{ -->
|
|
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
|
|
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
|
|
<SDLCheck>true</SDLCheck>
|
|
</ClCompile>
|
|
<Link>
|
|
<SubSystem>Windows</SubSystem>
|
|
</Link>
|
|
<Lib>
|
|
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
|
|
</Lib>
|
|
</ItemDefinitionGroup>
|
|
|
|
<!-- C++ source compile-specific things for Debug/Release configurations -->
|
|
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<Optimization>Disabled</Optimization>
|
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
</ClCompile>
|
|
<Link>
|
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<Optimization>MaxSpeed</Optimization>
|
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
</ClCompile>
|
|
<Link>
|
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
<OptimizeReferences>true</OptimizeReferences>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
|
|
<!-- Hybrid CRT: the VC++ runtime and STL stay static (/MT); the UCRT comes from the in-box ucrtbase.dll.
|
|
Every module shares that UCRT, so don't change process-wide CRT state (doc/devdocs/development/guidelines.md). -->
|
|
<PropertyGroup>
|
|
<EnableHybridCRT Condition="'$(EnableHybridCRT)' == ''">true</EnableHybridCRT>
|
|
</PropertyGroup>
|
|
<ItemDefinitionGroup Condition="'$(EnableHybridCRT)' == 'true' and '$(Configuration)' == 'Debug'">
|
|
<Link>
|
|
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrtd.lib</IgnoreSpecificDefaultLibraries>
|
|
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrtd.lib</AdditionalOptions>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
<ItemDefinitionGroup Condition="'$(EnableHybridCRT)' == 'true' and '$(Configuration)' == 'Release'">
|
|
<Link>
|
|
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrt.lib</IgnoreSpecificDefaultLibraries>
|
|
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrt.lib</AdditionalOptions>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
|
|
<!-- Global props OverrideWindowsTargetPlatformVersion-->
|
|
<PropertyGroup Label="Globals">
|
|
<WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
|
|
<TargetPlatformVersion>10.0.26100.0</TargetPlatformVersion>
|
|
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
|
|
</PropertyGroup>
|
|
|
|
<!-- Props that are constant for both Debug and Release configurations -->
|
|
<PropertyGroup Label="Configuration">
|
|
<PlatformToolset>v143</PlatformToolset>
|
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '18.0'">v145</PlatformToolset>
|
|
<CharacterSet>Unicode</CharacterSet>
|
|
<DesktopCompatible>true</DesktopCompatible>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
vcpkg integration. Set globally and loaded before Microsoft.Cpp.props (via
|
|
ForceImportBeforeCppProps) so that vcpkg.props' ClCompile hook is in place
|
|
before the C++ targets run. VcpkgRoot is resolved via the same three-tier
|
|
fallback used by microsoft/terminal (env var → VS-shipped → deps/vcpkg).
|
|
-->
|
|
<PropertyGroup Label="vcpkg">
|
|
<VcpkgEnabled>true</VcpkgEnabled>
|
|
<VcpkgEnableManifest>true</VcpkgEnableManifest>
|
|
<VcpkgManifestEnabled>true</VcpkgManifestEnabled>
|
|
<VcpkgManifestRoot>$(MSBuildThisFileDirectory)</VcpkgManifestRoot>
|
|
<VcpkgOSTarget>windows</VcpkgOSTarget>
|
|
<VcpkgUseStatic>true</VcpkgUseStatic>
|
|
<!--
|
|
Force VcpkgConfiguration to follow $(Configuration). Without this,
|
|
vcpkg.props infers VcpkgConfiguration from $(UseDebugLibraries), which
|
|
Microsoft.Cpp.Default.props has already defaulted to 'false' by the
|
|
time vcpkg.props is imported here (the PowerToys-wide Debug override
|
|
below runs LATER). That would silently link the Release-built spdlog
|
|
into Debug consumers and trigger LNK2038 (MT/MTd, _ITERATOR_DEBUG_LEVEL).
|
|
-->
|
|
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
|
|
<!-- vcpkg validates triplets case-sensitively; PowerToys uses ARM64 capital-case. -->
|
|
<VcpkgPlatformTarget Condition="'$(Platform)' == 'ARM64'">arm64</VcpkgPlatformTarget>
|
|
<VcpkgApplocalDeps>false</VcpkgApplocalDeps>
|
|
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)vcpkg_installed\$(Platform)\</VcpkgInstalledDir>
|
|
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$(VCPKG_ROOT)</VcpkgRoot>
|
|
<VcpkgRoot Condition="'$(VcpkgRoot)' == '' and '$(VsInstallRoot)' != ''">$(VsInstallRoot)\VC\vcpkg</VcpkgRoot>
|
|
<VcpkgRoot Condition="'$(VcpkgRoot)' == '' or !Exists('$(VcpkgRoot)\vcpkg.exe')">$(MSBuildThisFileDirectory)deps\vcpkg</VcpkgRoot>
|
|
<CAExcludePath>$(CAExcludePath);$(VcpkgInstalledDir)</CAExcludePath>
|
|
<VCPkgLocalAppDataDisabled>true</VCPkgLocalAppDataDisabled>
|
|
</PropertyGroup>
|
|
<!-- Fail fast with an actionable message instead of opaque C1083 spdlog/spdlog.h errors. -->
|
|
<Target Name="PowerToysEnsureVcpkgAvailable"
|
|
BeforeTargets="PrepareForBuild"
|
|
Condition="'$(MSBuildProjectExtension)' == '.vcxproj' and '$(VcpkgEnabled)' == 'true' and !Exists('$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props')">
|
|
<Error Text="PowerToys requires the 'vcpkg' Visual Studio component, but it was not found.%0A%0AOpen the Visual Studio Installer, click Modify on your VS install, search for 'vcpkg', enable 'C++ vcpkg package manager', and click Modify. (Visual Studio will also prompt you to install missing .vsconfig components when you open PowerToys.slnx.)%0A%0AIf you have vcpkg installed elsewhere, set the VCPKG_ROOT environment variable to its root before building.%0A%0ASearched: '$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props'" />
|
|
</Target>
|
|
<Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props"
|
|
Condition="'$(MSBuildProjectExtension)' == '.vcxproj' and Exists('$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props')" />
|
|
|
|
|
|
<!-- Debug/Release props -->
|
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
|
<UseDebugLibraries>true</UseDebugLibraries>
|
|
<LinkIncremental>true</LinkIncremental>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
|
<UseDebugLibraries>false</UseDebugLibraries>
|
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
<LinkIncremental>false</LinkIncremental>
|
|
</PropertyGroup>
|
|
|
|
</Project>
|