Skip to content

Add single-file host tests for native library load #115061

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 2 commits into from
Apr 28, 2025

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Apr 25, 2025

cc @dotnet/appmodel @AaronRobinsonMSFT

@elinor-fung elinor-fung added this to the 10.0.0 milestone Apr 25, 2025
@Copilot Copilot AI review requested due to automatic review settings April 25, 2025 20:34
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 introduces single-file host tests for native library loading by adding new test cases and helper functions for both P/Invoke and NativeLibrary API loading.

  • Added new switch cases in Program.cs to invoke native library loading functions.
  • Implemented the LoadNativeLibrary class with methods for P/Invoke and API-based loading.
  • Developed XUnit tests in NativeLibraries.cs to verify the native library load behavior.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/installer/tests/Assets/Projects/HelloWorld/Program.cs Added cases to trigger native library loading via P/Invoke and API.
src/installer/tests/Assets/Projects/HelloWorld/LoadNativeLibrary.cs Introduced native library load functions including P/Invoke wrappers and API usage.
src/installer/tests/AppHost.Bundle.Tests/NativeLibraries.cs Created XUnit tests to validate native library loading in various modes.

Copy link
Contributor

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

.Should().Pass()
.And.CallPInvoke(null, true)
.And.CallPInvoke(DllImportSearchPath.AssemblyDirectory, true)
// Single-file always looks in application directory, even when only System32 is specified
Copy link
Member Author

Choose a reason for hiding this comment

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

See #114717

@elinor-fung elinor-fung merged commit ef0076b into dotnet:main Apr 28, 2025
75 checks passed
@elinor-fung elinor-fung deleted the singleFile-nativeLibraryTests branch May 5, 2025 18:35
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.

2 participants