dotnet / dotnet/dotnet-api-docs

Incomplete DefaultDllImportSearchPaths docs

Open
#3,205 3 comments 2 reactions 0 assignees View on GitHub
area-System.Security cross-platform Pri3 product-question waiting-on-feedback
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

https://github.com/dotnet/dotnet-api-docs/blob/8adb892bc4a3f45fdeaa24f716d2dbd4ba0365ab/xml/System.Runtime.InteropServices/DefaultDllImportSearchPathsAttribute.xml

.NET Core 3.0 will bring `DefaultDllImportSearchPathsAttribute`, and [the Roslyn analyzers will flag P/Invokes that lack `DefaultDllImportSearchPathsAttribute` by default](https://github.com/dotnet/roslyn-analyzers/pull/2658). However, the documentation on `DefaultDllImportSearchPathsAttribute` is Windows-centric; it doesn't describe how `DefaultDllImportSearchPathsAttribute` works on Linux, for example.

This is a problem for code such at the following snippet taken from https://github.com/dotnet/corefx/blob/master/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.RAND.cs (with a constant replaced with a literal):

``` csharp
[DllImport("System.Security.Cryptography.Native.OpenSsl")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern unsafe bool CryptoNative_GetRandomBytes(byte* buffer, int length);
```

The options available for `DefaultDllImportSearchPathsAttribute` are aimed at Windows, and the documentation doesn't make it clear how to handle this. Is the attribute completely ignored? Are only certain options available?

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.