Skip to content

[1.8-stable] Gated port: MrmGetFilePathFromName S_OK fallback (#6603) - #6617

Merged
Scott Jones (Scottj1s) merged 1 commit into
release/1.8-stablefrom
user/scottj1s/mrm-fallback-1.8-cp
Jul 17, 2026
Merged

Scott Jones (Scottj1s) merged 1 commit into
release/1.8-stablefrom
user/scottj1s/mrm-fallback-1.8-cp

Conversation

@Scottj1s

Copy link
Copy Markdown
Member

Ports the MrmGetFilePathFromName fix (main #6603, 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.

Background

MrmGetFilePathFromName is documented to always succeed and return a best-effort path even when no PRI file exists. On release/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).

Containment (ContainmentV1 / 2-arg form)

1.8 uses the older ContainmentV1 model where IsChangeEnabled requires a target servicing 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): 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/WindowsAppSDKDisabledChanges, or runtime pinned before 1.8.11): reverts byte-for-byte to current release/1.8-stable (ERROR_FILE_NOT_FOUND). Both terminal search passes jump to Final, skipping the DefaultFallback pass.

WinAppSDK_1_8_11 is the next servicing slot (highest currently used is WinAppSDK_1_8_10).

Changes

  • MRM.cpp — gate the reachable DefaultFallback pass + S_OK return on IsChangeEnabled<WINAPPSDK_CHANGEID_63048673>(). Adds #include <FrameworkUdk/Containment.h> + the inline #define. Preserves the module directory since the parent-folder search mutates exeDir in place.
  • MRM.vcxproj — link the FrameworkUdk Containment worker.
  • MrmUnitTest.vcxproj — link FrameworkUdk and deploy Microsoft.Internal.FrameworkUdk.dll next to the test host.
  • MrmTests.cpp — strengthen GetFilePath (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 GetFilePath / DefaultResourceManager entries so they gate again.

Not changed

Helper.cpp is intentionally untouched: 1.8 has no sparse-packaged [modulename].pri fallback block (that landed later, gated on 62382643 on 2.0), so the S_OK result flows through GetDefaultPriFile without adjustment. Confirmed no other 1.8 caller depends on the ERROR_FILE_NOT_FOUND failure.

Validation

Built MrtCore.sln native 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).

…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>
@Scottj1s

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@Scottj1s
Scott Jones (Scottj1s) merged commit 00db8a8 into release/1.8-stable Jul 17, 2026
40 checks passed
@Scottj1s
Scott Jones (Scottj1s) deleted the user/scottj1s/mrm-fallback-1.8-cp branch July 17, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant