Consider marking `DllImportSearchPath` values that don't make sense outside Windows as `[SupportedOSPlatform("windows")]`

Open
#119,332 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp

Research direction

Start by locating the DllImportSearchPath declaration and reviewing the existing platform-compatibility annotations. Determine which values besides AssemblyDirectory should be marked as Windows-only, then verify that the resulting API annotations and compatibility behavior match the issue’s scope.

Written by the indexing model from the issue text.

Description

area-System.Runtime.InteropServices

Would it make sense to mark DllImportSearchPath values that don't make sense outside Windows as [SupportedOSPlatform("windows")]?

Originally posted by @MichalStrehovsky in https://github.com/dotnet/runtime/pull/119287#pullrequestreview-3178965639

Only DllImportSearchPath.AssemblyDirectory means anything on non-Windows.

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.