[2.0-stable] Gated cherry-pick: MrmGetFilePathFromName S_OK fallback (#6603)#6612
Open
Scottj1s wants to merge 1 commit into
Open
[2.0-stable] Gated cherry-pick: MrmGetFilePathFromName S_OK fallback (#6603)#6612Scottj1s wants to merge 1 commit into
Scottj1s wants to merge 1 commit into
Conversation
…/2.0-stable Cherry-picks PR #6603 into release/2.0-stable, but gates the behavior change behind a RuntimeCompatibilityOptions containment check so apps can disable it. MrmGetFilePathFromName is documented to always succeed and return a best-effort path even when no PRI file exists. On 2.0-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). Because this changes an HRESULT from a failure to S_OK, the change is contained under WINAPPSDK_CHANGEID_63048673: - Enabled (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): behavior reverts byte-for-byte to the current 2.0-stable behavior (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>(). Add #include <FrameworkUdk/Containment.h> and an inline #define for the change ID, following the existing 62382643 precedent in Helper.cpp. 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: deploy Microsoft.Internal.FrameworkUdk.dll next to the test host (mrm.dll now imports it). - Helper.cpp (GetDefaultPriFile): inside the existing 62382643 block, gate the sparse-packaged [modulename].pri fallback on actual file existence (CheckFile) so it still fires once MrmGetFilePathFromName returns S_OK. Correct whether 63048673 is enabled or disabled; preserves 62382643 behavior. - MrmTests.cpp: strengthen GetFilePath to assert the fallback path is under the module directory. - BypassTests.json: remove the now-passing UnitTest::BasicTest::GetFilePath and MrtCoreUnpackagedTests.TestClass.DefaultResourceManager entries so they gate. Note for release engineering: per the ContainmentV2 model this PR only defines and gates the change ID; associating 63048673 to a release group in RuntimeCompatibilityOptions.cpp's s_catalogGroupsProd[] is the separate branch-cut step. Verified locally (x64 Debug): MrmUnitTest 21/21 (change enabled by default). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Cherry-picks #6603 into
release/2.0-stable, gated behind a RuntimeCompatibilityOptions containment check so apps can disable it.Background
MrmGetFilePathFromNameis documented to always succeed and return a best-effort path even when no PRI file exists. Onrelease/2.0-stableit fails withERROR_FILE_NOT_FOUND, which makesnew ResourceManager()throw when there is noresources.pri(the XAML-island / no-PRI scenario — original issues #5814 / #5940, fixed onmainby #6603).Containment
Because this flips an HRESULT from a failure to
S_OK, the change is contained underWINAPPSDK_CHANGEID_63048673:MrmGetFilePathFromNamereturnsS_OKwith a non-null best-effort path (the provided filename, elseresources.pri) under the base directory (if set) otherwise the module directory.RuntimeCompatibilityOptions/WindowsAppSDKDisabledChanges): behavior reverts byte-for-byte to currentrelease/2.0-stable(ERROR_FILE_NOT_FOUND). Both terminal search passes jump toFinal, skipping theDefaultFallbackpass.The gate is placed in
MrmGetFilePathFromNameitself, so it contains the public export's HRESULT flip for bothResourceManagerand any direct external callers.Changes
DefaultFallbackpass +S_OKreturn onIsChangeEnabled<WINAPPSDK_CHANGEID_63048673>(). Adds#include <FrameworkUdk/Containment.h>+ an inline#definefor the change ID (following the existing62382643precedent in Helper.cpp). Preserves the module directory since the parent-folder search mutatesexeDirin place.EnsureNuGetPackageBuildImports).Microsoft.Internal.FrameworkUdk.dllnext to the test host (mrm.dllnow imports it).GetDefaultPriFile) — inside the existing62382643block, gate the sparse-packaged[modulename].prifallback on actual file existence (CheckFile) so it still fires onceMrmGetFilePathFromNamereturnsS_OK. Correct whether63048673is enabled or disabled; preserves62382643behavior.GetFilePathto assert the fallback path is under the module directory.UnitTest::BasicTest::GetFilePathandMrtCoreUnpackagedTests.TestClass.DefaultResourceManagerentries so they gate again.Note for release engineering
Per the ContainmentV2 model this PR only defines and gates the change ID. Associating
63048673to a release group inRuntimeCompatibilityOptions.cpp'ss_catalogGroupsProd[]is the separate branch-cut step (same as the existing62382643).Validation
Built
MrtCore.slnnative projects (x64 Debug) locally;MrmUnitTest21/21 (change enabled by default,GetFilePathreturnsS_OKwith a valid module-dir path). Disabled-path behavior is byte-equivalent to currentrelease/2.0-stableby construction. The Helper.cpp logic is identical to #6603, validated 27/27 (incl.DefaultResourceManager) onmain.