-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UndockedRegFreeWinRT doesn't check Dynamic packages for WinRT Metadata #1649
UndockedRegFreeWinRT doesn't check Dynamic packages for WinRT Metadata #1649
Conversation
…'t just search static package graph entries (and fail to find metadata in dynamic packages)
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
I feel we still need to do static check above, but here call GetCurrentPackageInfo(DYNAMIC), and try to find the type in each dependency path. Refers to: dev/UndockedRegFreeWinRT/typeresolution.cpp:455 in 1f6f5f7. [](commit_id = 1f6f5f7, deletion_comment = False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like there is a missing test or tests here?
We've got a manual test how we discovered it and will verify. URFW has zero direct tests here. Known issue on the backlog. |
@huichen123 Why split the check for Static+Dynamic instead of the 1 call above? |
for packaged app, we don't need to handle here. |
Is it harmful or just inefficient? |
inefficient? I don't know this code. You'd want to check with the owner. Regardless, it needs to handle unpackaged app with dynamic package graph. |
I ping'd @kythant above. It's a bit of a mixed ownership
Yes, hence this PR. |
|
Aha! Yes, sorry, brain fart on my part. Update posted. |
/azp run |
…'t just search static package graph entries (and fail to find metadata in dynamic packages)
dbf83fb
to
c9bc151
Compare
…red to get the whole package graph
…esolveThirdPartyType
// Walk the dynamic package graph looking for the requested metadata | ||
const uint32_t filter{ PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT | PACKAGE_FILTER_IS_IN_RELATED_SET | PACKAGE_FILTER_DYNAMIC }; | ||
// Walk the package graph looking for the requested metadata | ||
const uint32_t filter{ PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT | PACKAGE_FILTER_IS_IN_RELATED_SET | PACKAGE_FILTER_DYNAMIC | PACKAGE_FILTER_STATIC }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an undocumented flag, though is in the public SDK.
#define PACKAGE_PROPERTY_STATIC 0x00080000
#define PACKAGE_FILTER_STATIC PACKAGE_PROPERTY_STATIC
Can you shed some light on what it does and/or edit the docs? https://docs.microsoft.com/windows/win32/appxpkg/package-constants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc update is coming. In the meantime...
- PACKAGE_PROPERTY_STATIC - search the package graph's static entries
- PACKAGE_PROPERTY_DYNAMIC - search the package graph's dynamic entries
Packaged apps are born with entries in their package graph, aka static package graph entries, aka the static portion of the package graph or more simply, the static package graph.
Unpackaged apps are born with an empty package graph.
The Dynamic Dependency API adds entries dynamically to the package graph, aka dynamic package graph entries, aka the dynamic portion of the package graph or more simply, the dynamic package graph
For backwards compatibility reasons GetCurrentPackageInfo[2](...filter...)
assumes if filter
doesn't contain PACKAGE_FILTER_DYNAMIC
then only look at the static package graph. IOW calling GetCurrentPackageInfo[2]()
without PACKAGE_FILTER_DYNAMIC
is implicitly the same as calling GetCurrentPackageInfo2with
PACKAGE_FILTER_STATIC`.
This is explained in the comment block in DynamicGetCurrentPackageInfo2()in
dev\DynamicDependency\API\MddDetourPacckageGraph.cpp`:
// Legacy callers may not be aware of dynamic packages and a common mistake is to assume PACKAGE_FILTER_HEAD will return the
// main package as the first entry which is not going to be true when packages have been added dynamically to the head of the graph.
// Maintain pre-dynamic behavior by requiring the caller to opt into receiving dynamic packages.
Thus GetCurrentPackageInfo[2]()
are dynamic-oblivous unless explicitly told to consider dynamic package graph entries.
OTOH GetCurrentPackageInfo3()
assumes the caller is dynamic-savvy so it doesn't make any such backwards compatibility game. If you specify neither option to GetCurrentPackageInfo3()
it's equivalent to specifying both (i.e. search static+dynamic entries).
…esolveThirdPartyType
…PartyType' of https://github.com/microsoft/ProjectReunion into user/drustheaxe/URFW-GetCurrentPackageInfo-ResolveThirdPartyType
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments are suggestions / stylistic. Non-blocking, so signing off.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Tests exist in the aggregator pipeline As noted in the description, I manually tested by using those tests to see the repro fail, then updated microsoft.windowsappruntime.dll and watched the test succeed. Plus a lot of interesting walk-the-debugger-through-the-code. Functional tests will be added here (under |
#1649) * Added PACKAGE_FILTER_STATIC|DYNAMIC so metadata resolution also doesn't just search static package graph entries (and fail to find metadata in dynamic packages) * Revise ResolveThirdPartyType() to be savvy to dynamic package graph * Incorporated feedback * Added PACKAGE_FILTER_STATIC|DYNAMIC so metadata resolution also doesn't just search static package graph entries (and fail to find metadata in dynamic packages) * Revise ResolveThirdPartyType() to be savvy to dynamic package graph * Incorporated feedback * Add Dynamic+Static filters when retrieving the package graph as required to get the whole package graph * Fix check for not-found-in-package-graph-let's-try-exe-dir * Updated by VS * Incorporated feedback
#1649) (#2537) * Added PACKAGE_FILTER_STATIC|DYNAMIC so metadata resolution also doesn't just search static package graph entries (and fail to find metadata in dynamic packages) * Revise ResolveThirdPartyType() to be savvy to dynamic package graph * Incorporated feedback * Added PACKAGE_FILTER_STATIC|DYNAMIC so metadata resolution also doesn't just search static package graph entries (and fail to find metadata in dynamic packages) * Revise ResolveThirdPartyType() to be savvy to dynamic package graph * Incorporated feedback * Add Dynamic+Static filters when retrieving the package graph as required to get the whole package graph * Fix check for not-found-in-package-graph-let's-try-exe-dir * Updated by VS * Incorporated feedback
Fixes https://task.ms/36717508
Add PACKAGE_FILTER_STATIC|DYNAMIC in
ResolveThirdPartyType()
so metadata resolution also doesn't just search static package graph entries (and fail to find metadata in dynamic packages)Kudos to @huichen123 for spotting the problem
Manually tested by applying privates to the UndockedRegFreeWinRT IntegratedTest (URFW_ExeUsingWinAppSDK.exe) and tracing code flow in the debugger for the various permutations of usage.
closes #2382