dotnet / dotnet/dotnet-api-docs

Update documentation for NativeLibrary.Load/TryLoad to reflect .NET 5 changes.

Open
#4,084 0 comments 0 reactions 0 assignees View on GitHub
area-System.Reflection Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

For .NET 5, `NativeLibrary.Load` and `NativeLibrary.TryLoad` APIs that take an `Assembly` will be updated to follow the native assembly resolution logic of the `AssemblyLoadContext` of the specified assembly. They will go through the extension points for the AssemblyLoadContext of the specified assembly:
- Call the `AssemblyLoadContext.LoadUnmanagedDll` function
- Fire the `AssemblyLoadContext.ResolvingUnmanagedDll` event

Related runtime change: dotnet/runtime#34519

This change should first appear in .NET 5 Preview 4.

Affected APIs:
- `NativeLibrary.Load(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)`
- `NativeLibrary.TryLoad(string libraryName, Assembly assembly, DllImportSearchPath? searchPath, out IntPtr handle)`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.