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

Fix Windows 7 'api-ms-win-core-winrt-string-l1-1-0.dll' error #14436

Merged

Conversation

david-szabo97
Copy link
Contributor

What does the pull request do?

Add a check before creating any HStringInterop in the WinRTApiInformation class.

What is the current behavior?

HStringInterop class is instantiated even when WinRTMethods is not available on the current Windows version.

What is the updated/expected behavior with this PR?

HStringInterop class won't be instantiated, therefore it won't try to load 'api-ms-win-core-winrt-string-l1-1-0.dll' which causes crash on Windows 7.

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

#14309

@david-szabo97
Copy link
Contributor Author

@dotnet-policy-service agree

@david-szabo97
Copy link
Contributor Author

Alternatively, we could make this a one-line PR by checking for the Windows version here. Although the behavior would be more implicit, I prefer doing the checks in the methods.

_s = s == null ? IntPtr.Zero : NativeWinRTMethods.WindowsCreateString(s);

@avaloniaui-bot
Copy link

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

@maxkatz6
Copy link
Member

maxkatz6 commented Feb 1, 2024

Thank you! Current changes look good for me. Changing HString code would be more invasive, as it would affect WinRT Compositor code, which doesn't need additional version checks.

@maxkatz6 maxkatz6 added bug os-windows backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Feb 1, 2024
@maxkatz6 maxkatz6 merged commit e68ae6a into AvaloniaUI:master Feb 1, 2024
6 checks passed
@timunie
Copy link
Contributor

timunie commented Feb 2, 2024

Just fyi @david-szabo97 if you add the keyword fixes #xxxx then the issue will close automatically.

Thanks for your contribution 🙏

@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Feb 8, 2024
Copy link

@LYCLIEKKAS10 LYCLIEKKAS10 left a comment

Choose a reason for hiding this comment

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

Brain

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.

5 participants