From 3749fdc4984ee09f4d899feb5f919648fc029f7e Mon Sep 17 00:00:00 2001 From: guimafelipe Date: Fri, 22 May 2026 11:32:27 -0700 Subject: [PATCH] Use IsPackagedProcess() for package detection in PRI fallback Replace inferring packaged state from GetDefaultPriFileForCurrentPackage's HRESULT with AppModel::Identity::IsPackagedProcess() which properly handles GetCurrentPackageFullName errors. --- .../src/Helper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/MRTCore/mrt/Microsoft.Windows.ApplicationModel.Resources/src/Helper.cpp b/dev/MRTCore/mrt/Microsoft.Windows.ApplicationModel.Resources/src/Helper.cpp index 58d419c808..c3fb916caa 100644 --- a/dev/MRTCore/mrt/Microsoft.Windows.ApplicationModel.Resources/src/Helper.cpp +++ b/dev/MRTCore/mrt/Microsoft.Windows.ApplicationModel.Resources/src/Helper.cpp @@ -3,6 +3,7 @@ #include "pch.h" #include "frameworkudk\ResourceManager.h" +#include bool IsResourceNotFound(HRESULT hr) { @@ -83,7 +84,7 @@ HRESULT GetDefaultPriFile(winrt::hstring& filePath) // GetDefaultPriFileForCurrentPackage will not handle the new case where // resources.pri is in the parent folder. - bool isPackaged = (hr != HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE)); + bool isPackaged = AppModel::Identity::IsPackagedProcess(); hr = GetDefaultPriFileForCurentModule(isPackaged, filePath); // Sparse-packaged apps have identity but deploy PRI files as loose files; fall back to unpackaged discovery which also searches for "[modulename].pri".