Repository navigation
[1.8-stable] Gated port: MrmGetFilePathFromName S_OK fallback (#6603) - #6617
Merged
Scott Jones (Scottj1s) merged 1 commit intoJul 17, 2026
Merged
Conversation
…6603) Ports the MrmGetFilePathFromName fix (main #6603, also cherry-picked to release/2.0-stable in #6612) into release/1.8-stable, gated behind a runtime-compatibility containment change so apps can disable it. MrmGetFilePathFromName is documented to always succeed and return a best-effort path even when no PRI file exists. On 1.8-stable it fails with ERROR_FILE_NOT_FOUND, which makes `new ResourceManager()` throw when there is no resources.pri (the XAML-island / no-PRI scenario - issue #5814). 1.8 uses the ContainmentV1 model where IsChangeEnabled requires a target patch version, so the change ID macro bakes it in: #define WINAPPSDK_CHANGEID_63048673 63048673, WinAppSDK_1_8_11 - Enabled (runtime at/after 1.8.11, default): MrmGetFilePathFromName returns S_OK with a non-null best-effort path (the provided filename, else resources.pri) under the base directory (if set) otherwise the module directory. - Disabled (via RuntimeCompatibilityOptions) or runtime pinned before 1.8.11: behavior reverts byte-for-byte to current 1.8-stable (ERROR_FILE_NOT_FOUND). Both terminal search passes jump to Final, skipping the DefaultFallback pass. Changes: - MRM.cpp: gate the reachable DefaultFallback pass + S_OK return on IsChangeEnabled<WINAPPSDK_CHANGEID_63048673>() (2-arg ContainmentV1 form). Add #include <FrameworkUdk/Containment.h> and the inline #define. Preserve the module directory since the parent-folder search mutates exeDir in place. - MRM.vcxproj: link the FrameworkUdk Containment worker (targets import + EnsureNuGetPackageBuildImports). - MrmUnitTest.vcxproj: link FrameworkUdk and deploy Microsoft.Internal.FrameworkUdk.dll next to the test host. - MrmTests.cpp: strengthen GetFilePath to assert the fallback path is under the module directory; add ContainmentDisabledTest (IsolationLevel=Method) that disables 63048673 via SetConfiguration and verifies the pre-fix ERROR_FILE_NOT_FOUND behavior. - BypassTests.json: remove the now-passing UnitTest::BasicTest::GetFilePath and MrtCoreUnpackagedTests.TestClass.DefaultResourceManager entries so they gate. Helper.cpp is intentionally NOT changed: 1.8 has no sparse-packaged PRI fallback block (that came later), so the S_OK result flows through GetDefaultPriFile without adjustment. Verified locally (x64 Debug): MrmUnitTest 22/22, including both the enabled (GetFilePath) and disabled (GetFilePathFallbackDisabled) cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the
MrmGetFilePathFromNamefix (main #6603, cherry-picked torelease/2.0-stablein #6612) intorelease/1.8-stable, gated behind a runtime-compatibility containment change so apps can disable it.Background
MrmGetFilePathFromNameis documented to always succeed and return a best-effort path even when no PRI file exists. Onrelease/1.8-stableit fails withERROR_FILE_NOT_FOUND, which makesnew ResourceManager()throw when there is noresources.pri(the XAML-island / no-PRI scenario — issue #5814).Containment (ContainmentV1 / 2-arg form)
1.8 uses the older ContainmentV1 model where
IsChangeEnabledrequires a target servicing patch version, so the change-ID macro bakes it in:S_OKwith a non-null best-effort path (the provided filename, elseresources.pri) under the base directory (if set) otherwise the module directory.RuntimeCompatibilityOptions/WindowsAppSDKDisabledChanges, or runtime pinned before 1.8.11): reverts byte-for-byte to currentrelease/1.8-stable(ERROR_FILE_NOT_FOUND). Both terminal search passes jump toFinal, skipping theDefaultFallbackpass.WinAppSDK_1_8_11is the next servicing slot (highest currently used isWinAppSDK_1_8_10).Changes
DefaultFallbackpass +S_OKreturn onIsChangeEnabled<WINAPPSDK_CHANGEID_63048673>(). Adds#include <FrameworkUdk/Containment.h>+ the inline#define. Preserves the module directory since the parent-folder search mutatesexeDirin place.Microsoft.Internal.FrameworkUdk.dllnext to the test host.GetFilePath(assert the fallback path is under the module directory); addContainmentDisabledTest(IsolationLevel=Method) that disables63048673viaSetConfigurationand verifies the pre-fixERROR_FILE_NOT_FOUNDbehavior.GetFilePath/DefaultResourceManagerentries so they gate again.Not changed
Helper.cppis intentionally untouched: 1.8 has no sparse-packaged[modulename].prifallback block (that landed later, gated on62382643on 2.0), so theS_OKresult flows throughGetDefaultPriFilewithout adjustment. Confirmed no other 1.8 caller depends on theERROR_FILE_NOT_FOUNDfailure.Validation
Built
MrtCore.slnnative projects (x64 Debug) locally; MrmUnitTest 22/22, including both:BasicTest::GetFilePath(enabled →S_OK+ valid module-dir path)ContainmentDisabledTest::GetFilePathFallbackDisabled(disabled →ERROR_FILE_NOT_FOUND)Related: #6603 (main), #6612 (2.0-stable).