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

[Build] Fix native library loading picking up invalid files #1999

Merged
merged 1 commit into from Oct 29, 2023

Conversation

Basewq
Copy link
Contributor

@Basewq Basewq commented Oct 28, 2023

PR Details

Description

NuGet importer allows 'non-native' files in LockFileTargetLibrary.NativeLibraries, however as per research #1750 (comment) this leads to a subtle incorrect dll loading if multiple files with the same file name exists (eg. freetype.dll & freetype.pdb).
Wasn't sure whether a blacklist, whitelist or some priority sort would be preferred to ensure the correct file get loaded. I've settled on a small blacklist set but I'm open to change it to a different way.
EDIT: Changed to allowlist logic.

Related Issue

Fixes #1750

Motivation and Context

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@manio143
Copy link
Member

If these are native libs we expect to collect here I think an allowlist for dll, so, dylib and any other lib extension would be better to avoid having to amend this list much in the future if other files are accidentally included.

@Basewq
Copy link
Contributor Author

Basewq commented Oct 29, 2023

If these are native libs we expect to collect here I think an allowlist for dll, so, dylib and any other lib extension would be better to avoid having to amend this list much in the future if other files are accidentally included.

Fair enough. Are you aware of any other extensions?
According to this https://learn.microsoft.com/en-us/dotnet/standard/native-interop/native-library-loading
it seems like there's only those three, but looks like we will also need to include .Contains(".so.") for linux files.
Unfortunately, I'm not knowledgeable on about non-Windows platforms so not sure what file types they use.

@manio143
Copy link
Member

As far as I could see iOS and MacOS use dylib and Android and Linux use so. At the moment this should be enough.

@manio143 manio143 merged commit 83525ef into stride3d:master Oct 29, 2023
1 check passed
@Basewq Basewq deleted the font_fix branch October 29, 2023 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime rasterized fonts are completely broken
2 participants