Commit d5afea6
Fix sparse-packaged apps unable to discover module-specific PRI files (#6376)
* Fix sparse-packaged apps unable to discover module-specific PRI files
Sparse-packaged apps have package identity (via AddPackageByUriAsync) but
deploy resources as loose files next to the executable. GetDefaultPriFile()
determines isPackaged=true for these apps (since they have identity), causing
GetDefaultPriFileForCurentModule to pass "resources.pri" to
MrmGetFilePathFromName — which only searches for that exact filename,
skipping the [modulename].pri fallback that unpackaged apps receive.
When the "resources.pri" search fails for apps with identity, fall back to
the unpackaged discovery path (pass nullptr to MrmGetFilePathFromName) which
triggers the broader search including "[modulename].pri" derived via
PathCchRenameExtension from the process executable name.
If the fallback also fails, return the original HRESULT from the
"resources.pri" search so callers that check for specific errors
(e.g., ERROR_FILE_NOT_FOUND) are not broken.
Existing test coverage:
- DefaultResourceManagerWithExePri validates the nullptr fallback mechanism
- DefaultResourceManager validates error behavior when no PRI exists
- DefaultResourceManagerWithResourcePri validates the normal packaged path
A full sparse-app integration test requires actual sparse package
registration (AddPackageByUriAsync) which is beyond unit test scope.
Fixes: microsoft/microsoft-ui-xaml#10856
Co-authored-by: Copilot <[email protected]>
* Address PR review: simplify flow, shorten comment, gate on file-not-found
* Add backward-compatibility comment on return hr
* Move backward-compat comment to fallback block for clarity
* Keep comment sentences on single lines
* Use existing IsResourceNotFound() helper instead of manual HRESULT checks
* Merge two-line comment into single line
Agent-Logs-Url: https://github.com/microsoft/WindowsAppSDK/sessions/ed36cfc6-52ad-414b-8e1a-dc16f413a97e
Co-authored-by: yeelam-gordon <[email protected]>
---------
Co-authored-by: Copilot <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>1 parent 7c324df commit d5afea6
1 file changed
Lines changed: 15 additions & 1 deletion
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
88 | 102 | | |
0 commit comments