Skip to content

Fix passing flags in single-file tests for NativeLibrary.TryLoad #115173

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

Merged
merged 1 commit into from
Apr 30, 2025

Conversation

elinor-fung
Copy link
Member

Failed at passing the correct flags in tests added in #115061. 🤦

@elinor-fung elinor-fung added this to the 10.0.0 milestone Apr 30, 2025
@ghost ghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 30, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue in the single-file tests where incorrect flags were passed to NativeLibrary.TryLoad.

  • Changed the third parameter in the TryLoad API call from null to the provided flags.
  • Ensures that the intended flag values are used for loading native libraries.
Comments suppressed due to low confidence (1)

src/installer/tests/Assets/Projects/HelloWorld/LoadNativeLibrary.cs:43

  • Passing the correct flags instead of null fixes the expected behavior, but please verify that 'flags' is always set correctly when this function is called.
bool success = NativeLibrary.TryLoad(name, typeof(LoadNativeLibrary).Assembly, flags, out _);

@elinor-fung elinor-fung added area-Single-File and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 30, 2025
Copy link
Contributor

Tagging subscribers to this area: @agocke, @vitek-karas, @VSadov
See info in area-owners.md if you want to be subscribed.

@AaronRobinsonMSFT
Copy link
Member

Should a test be failing in this case?

@elinor-fung
Copy link
Member Author

Should a test be failing in this case?

Not yet. Because we currently always look in the app directory regardless of the flags, the tests are expected to pass.

@elinor-fung elinor-fung merged commit 043d49e into dotnet:main Apr 30, 2025
78 checks passed
@elinor-fung elinor-fung deleted the fixFlags-nativeLibraryTests branch May 1, 2025 01:44
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants