Skip to content
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

Implement ApiInformation checks #14090

Merged
merged 3 commits into from
Jan 3, 2024
Merged

Conversation

maxkatz6
Copy link
Member

@maxkatz6 maxkatz6 commented Jan 3, 2024

What does the pull request do?

Any WinRT API might not be available even if Windows version is supposed to support them (Win PE, Xbox...).
Using ApiInformation is a typical solution in UWP/WinUI apps, so we should do as well.

Fixed issues

Fixes #14058
Fixes #14040

@maxkatz6 maxkatz6 added os-windows backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Jan 3, 2024
@maxkatz6 maxkatz6 requested a review from a team January 3, 2024 06:34
@maxkatz6 maxkatz6 mentioned this pull request Jan 3, 2024
3 tasks
/// Any WinRT API might not be available even if Windows version is supposed to support them (Win PE, Xbox...).
/// Using ApiInformation is a typical solution in UWP/WinUI apps, so we should do as well.
/// </summary>
internal static unsafe class WinRTApiInformation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API could also be used in our WinRT Compositor classes to check where it is supported. But compositor APIs are a bit more complicated, as they are available pretty early for UWP, but Win32 handles support was introduced pretty late.

@maxkatz6 maxkatz6 added the bug label Jan 3, 2024
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0043280-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@Gillibald Gillibald added this pull request to the merge queue Jan 3, 2024
Merged via the queue into master with commit 00e9a3d Jan 3, 2024
6 checks passed
@Gillibald Gillibald deleted the IApiInformationStatics-check branch January 3, 2024 15:53
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Jan 17, 2024
maxkatz6 added a commit that referenced this pull request Jan 17, 2024
* Create wrapper for IApiInformationStatics

* Use ApiInformation APIs to get if WinRT types are supported

* Add some docs
#Conflicts:
#	src/Windows/Avalonia.Win32/Input/WindowsInputPane.cs
#	src/Windows/Avalonia.Win32/WinRT/winrt.idl
#	src/Windows/Avalonia.Win32/WindowImpl.cs
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.

4 participants