Skip to content

Commit 79404a8

Browse files
author
reunion-maestro-bot
committed
Syncing content from committish c4bd3c26ce72eeda7a036d18295374c450958b92
1 parent 10398c2 commit 79404a8

File tree

6 files changed

+90
-21
lines changed

6 files changed

+90
-21
lines changed

src/Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<PackageReference Update="CommunityToolkit.WinUI.Controls.SettingsControls" Version="$(CommunityToolkitWinUIVersion)" />
3131
<PackageReference Update="CommunityToolkit.WinUI.Converters" Version="$(CommunityToolkitWinUIVersion)" />
3232
<PackageReference Update="CommunityToolkit.WinUI.Animations" Version="$(CommunityToolkitWinUIVersion)" />
33+
<PackageReference Update="CommunityToolkit.WinUI.Controls.Primitives" Version="$(CommunityToolkitWinUIVersion)" />
3334
<PackageReference Update="Microsoft.Graphics.Win2D" Version="$(GraphicsWin2DVersion)" />
3435
<PackageReference Update="Win2d.uwp" Version="$(Win2DUWPVersion)" />
3536
<PackageReference Update="Win2d.winui" Version="$(Win2DWinUIVersion)" />

src/dxaml/xcp/core/inc/InputServices.h

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include "FrameworkInputViewHandler.h"
2020
#include "TextInputProducerHelper.h"
2121
#include <Microsoft.UI.Input.Partner.h>
22+
#include <FrameworkUdk/Containment.h>
23+
24+
// Bug 56962652: [1.6 Servicing] [FileExplorer] Fix crash due to activating DirectManipulationManager after HWND is destroyed
25+
#define WINAPPSDK_CHANGEID_56962652 56962652
2226

2327
// Uncomment for DManip debug outputs.
2428
//#define DM_DEBUG
@@ -1081,14 +1085,56 @@ class CInputServices final
10811085
return status == XcpDMViewportRunning || status == XcpDMViewportInertia || status == XcpDMViewportSuspended || status == XcpDMViewportAutoRunning;
10821086
}
10831087

1088+
// Checks if a window handle is valid the same way DirectManipulation's IDirectManipulationManager::Activate does.
1089+
static _Check_return_ HRESULT IsWindowHandleValid(_In_ HWND hWnd)
1090+
{
1091+
if (!IsWindow(hWnd))
1092+
{
1093+
return E_INVALIDARG;
1094+
}
1095+
1096+
DWORD hWndThreadId = ::GetWindowThreadProcessId(hWnd, NULL);
1097+
if (::GetCurrentThreadId() != hWndThreadId)
1098+
{
1099+
return HRESULT_FROM_WIN32(ERROR_WINDOW_OF_OTHER_THREAD);
1100+
}
1101+
1102+
return S_OK;
1103+
}
1104+
10841105
bool CanDMContainerInitialize() const
10851106
{
10861107
return !m_islandInputSiteRegistrations.empty();
10871108
}
10881109

1089-
bool CanDMContainerInitialize(_In_ CUIElement* const dmContainer) const
1110+
static bool CanDMIslandInputSiteInitialize(_In_opt_ ixp::IIslandInputSitePartner* const islandInputSite)
10901111
{
1091-
return dmContainer->CanDMContainerInitialize();
1112+
if (nullptr != islandInputSite)
1113+
{
1114+
HWND inputHwnd = CInputServices::GetUnderlyingInputHwndFromIslandInputSite(islandInputSite);
1115+
1116+
// Make sure the window handle is valid. The same code as DManip's IDirectManipulationManager::Activate
1117+
// is used. This ensures that Xaml will not attempt to activate a DManip manager with a handle that has
1118+
// already been destroyed with a WM_DESTROY message.
1119+
return SUCCEEDED(CInputServices::IsWindowHandleValid(inputHwnd));
1120+
}
1121+
return false;
1122+
}
1123+
1124+
// The DirectManipulationManager for a DMContainer can only occur after GetElementIslandInputSite returns a valid
1125+
// IslandInputSite since it is being used for DManip's initialization.
1126+
static bool CanDMContainerInitialize(_In_ CUIElement* const dmContainer)
1127+
{
1128+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_56962652>())
1129+
{
1130+
wrl::ComPtr<ixp::IIslandInputSitePartner> islandInputSite = dmContainer->GetElementIslandInputSite();
1131+
1132+
return CInputServices::CanDMIslandInputSiteInitialize(islandInputSite.Get());
1133+
}
1134+
else
1135+
{
1136+
return dmContainer->CanDMContainerInitialize();
1137+
}
10921138
}
10931139

10941140
// Creates a CUIDMContainer and CUIDMContainerHandler instance for the provided element and sets them up for future usage.

src/dxaml/xcp/core/input/InputServices.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3355,7 +3355,7 @@ CInputServices::InitializeDirectManipulationContainer(
33553355
IPALDirectManipulationService* pNewDirectManipulationService = NULL;
33563356
IPALDirectManipulationService* pDirectManipulationService = NULL;
33573357

3358-
ASSERT(CanDMContainerInitialize(pDMContainer));
3358+
ASSERT(CInputServices::CanDMContainerInitialize(pDMContainer));
33593359

33603360
IFCPTR(pDMContainer);
33613361

@@ -3640,6 +3640,13 @@ CInputServices::InitializeDirectManipulationContainers()
36403640
// and real viewport is instantiated.
36413641
for (auto& islandInputSiteRegistration : m_islandInputSiteRegistrations)
36423642
{
3643+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_56962652>())
3644+
{
3645+
if (!CInputServices::CanDMIslandInputSiteInitialize(islandInputSiteRegistration.IslandInputSite().Get()))
3646+
{
3647+
continue;
3648+
}
3649+
}
36433650
if (!islandInputSiteRegistration.DMCrossSlideService())
36443651
{
36453652
// Pre-create a DM manager for potential cross-slide handling, using cross-slide viewports
@@ -3678,7 +3685,7 @@ CInputServices::InitializeDirectManipulationContainers()
36783685
{
36793686
// Only keep containers that are inactive or do not have a valid IslandInputSite.
36803687
auto pDMContainer = elem.lock();
3681-
return pDMContainer && (!pDMContainer->IsActive() || !pDMContainer->CanDMContainerInitialize());
3688+
return pDMContainer && (!pDMContainer->IsActive() || !CInputServices::CanDMContainerInitialize(pDMContainer));
36823689
});
36833690

36843691
// Process all the remaining active containers

src/eng/Version.Details.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
<!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. See LICENSE in the project root for license information. -->
33
<Dependencies>
44
<ProductDependencies>
5-
<Dependency Name="Microsoft.WindowsAppSDK.Foundation.TransportPackage" Version="1.6.0-20250401.2.release">
5+
<Dependency Name="Microsoft.WindowsAppSDK.Foundation.TransportPackage" Version="1.6.0-20250429.2.release">
66
<Uri>https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDK</Uri>
7-
<Sha>414efd818c368210590c1e5b593b96f84cc3fbef</Sha>
7+
<Sha>6c54c38d820751bfbf738cd23d63d88f987707da</Sha>
88
</Dependency>
9-
<Dependency Name="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.6.4-CI-27106.2609.250401-0931.0">
9+
<Dependency Name="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.6.4-CI-27106.2611.250414-1100.0">
1010
<Uri>https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP</Uri>
11-
<Sha>bc5dd07ec77079c367657d193154a29681300d42</Sha>
11+
<Sha>aaee24f9a54adad0612b7f29001111ab4ee691cc</Sha>
1212
</Dependency>
13-
<Dependency Name="Microsoft.Internal.InteractiveExperiences" Version="1.6.4-CI-27106.2609.250401-0931.0">
13+
<Dependency Name="Microsoft.Internal.InteractiveExperiences" Version="1.6.4-CI-27106.2611.250414-1100.0">
1414
<Uri>https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP</Uri>
15-
<Sha>bc5dd07ec77079c367657d193154a29681300d42</Sha>
15+
<Sha>aaee24f9a54adad0612b7f29001111ab4ee691cc</Sha>
1616
</Dependency>
1717
<!-- Microsoft-WinUI-SDK subdirectory in WindowsAppSDKClosed (MSBuild and Visual Studio extensions for building, deploying, and debugging packaged applications.) -->
18-
<Dependency Name="Microsoft.Build.Msix" Version="1.6.0-release.20250401.0">
18+
<Dependency Name="Microsoft.Build.Msix" Version="1.6.0-release.20250428.1">
1919
<Uri>https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDKClosed</Uri>
20-
<Sha>84ead26dd3acbae2be42c469c757e08e4bc8a116</Sha>
20+
<Sha>8ecc6008812782550021699a4ba53e903d99b1c1</Sha>
2121
</Dependency>
2222
<!-- Closed source binary (ex PTLS and WinUIEdit) -->
23-
<Dependency Name="Microsoft.Internal.WinUIDetails" Version="1.610.0-release.20250401.0">
23+
<Dependency Name="Microsoft.Internal.WinUIDetails" Version="1.610.0-release.20250428.1">
2424
<Uri>https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDKClosed</Uri>
25-
<Sha>84ead26dd3acbae2be42c469c757e08e4bc8a116</Sha>
25+
<Sha>8ecc6008812782550021699a4ba53e903d99b1c1</Sha>
2626
</Dependency>
2727
</ProductDependencies>
2828
<ToolsetDependencies>

src/eng/sdkconfig.targets

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
<!-- Copyright (c) Microsoft Corporation. Licensed under the MIT License. See LICENSE in the project root for license information. -->
22
<Project>
3+
<!--
4+
NuGet will see both the latest package from the .NET SDK and
5+
the one we are overriding to and thereby emit an warning.
6+
Disabling that warning here.
7+
-->
8+
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
9+
<DisableCheckingDuplicateNuGetItems>true</DisableCheckingDuplicateNuGetItems>
10+
</PropertyGroup>
11+
312
<!--
413
Generally, the Microsoft.Windows.SDK.NET.Ref pack is bundled with the .NET SDK. Sometimes we need to override it, and it
5-
has to be done in after the Microsoft.NET.SDK has been imported, which means it needs to be in either the .csproj itself,
6-
or a .targets file
14+
has to be done after the Microsoft.NET.SDK has been imported, which means it needs to be in either the .csproj itself,
15+
or a .targets file. With .NET 9, the package name changed to Microsoft.Windows.SDK.NET.Ref.Windows. So we'll just remove
16+
any version we find before adding our explicitly versioned reference.
717
-->
8-
<ItemGroup Condition="'$(UsingMicrosoftNETSdk)'=='true' and '$(MicrosoftWindowsSDKNetRefPackVersionSuffixOverride)'!=''">
9-
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" RuntimeFrameworkVersion="$(TargetPlatformVersion.TrimEnd('0'))$(MicrosoftWindowsSDKNetRefPackVersionSuffixOverride)" />
10-
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" TargetingPackVersion="$(TargetPlatformVersion.TrimEnd('0'))$(MicrosoftWindowsSDKNetRefPackVersionSuffixOverride)" />
11-
</ItemGroup>
18+
<ItemGroup Condition="'$(UsingMicrosoftNETSdk)'=='true' and '$(MicrosoftWindowsSDKNetRefPackVersionSuffixOverride)'!='' and $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0-windows'))">
19+
<FrameworkReference Remove="Microsoft.Windows.SDK.NET.Ref;Microsoft.Windows.SDK.NET.Ref.Windows" />
20+
<FrameworkReference Include="Microsoft.Windows.SDK.NET.Ref"
21+
IsImplicitlyDefined="true"
22+
Pack="false"
23+
PrivateAssets="All"
24+
TargetingPackVersion="$(TargetPlatformVersion.TrimEnd('0'))$(MicrosoftWindowsSDKNetRefPackVersionSuffixOverride)"
25+
RuntimeFrameworkVersion="$(TargetPlatformVersion.TrimEnd('0'))$(MicrosoftWindowsSDKNetRefPackVersionSuffixOverride)" />
26+
</ItemGroup>
1227
</Project>

src/eng/versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<IxpTransportPackageVersion>$([System.Text.RegularExpressions.Regex]::Match($(VersionDetailsFileContents), 'Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage.*?Version="(.*?)"').Groups[1].Value)</IxpTransportPackageVersion>
4343
<IxpInternalPackageVersion>$([System.Text.RegularExpressions.Regex]::Match($(VersionDetailsFileContents), 'Microsoft.Internal.InteractiveExperiences.*?Version="(.*?)"').Groups[1].Value)</IxpInternalPackageVersion>
4444
<WinUIDetailsNugetVersion>$([System.Text.RegularExpressions.Regex]::Match($(VersionDetailsFileContents), 'Microsoft.Internal.WinUIDetails.*?Version="(.*?)"').Groups[1].Value)</WinUIDetailsNugetVersion>
45-
<MicrosoftBuildMsixVersion>1.6.0-release.20250401.0</MicrosoftBuildMsixVersion>
45+
<MicrosoftBuildMsixVersion>1.6.0-release.20250428.1</MicrosoftBuildMsixVersion>
4646
<!-- It is at this point that we might want our non-product code to be able to use a package version different than the primary configuration -->
4747
<!-- If so, this would probably be the point at which we would override the above version with what is configured for the app -->
4848
<!-- The package version identifies the targeted package version based on the configured packages. -->

0 commit comments

Comments
 (0)