Skip to content

Annotate Windows interop declarations with [SupportedOSPlatform("windows")] - #132778

Closed
pavelsavara with Copilot wants to merge 20 commits into
mainfrom
copilot/annotate-dllimport-libraryimport-support
Closed

Annotate Windows interop declarations with [SupportedOSPlatform("windows")]#132778
pavelsavara with Copilot wants to merge 20 commits into
mainfrom
copilot/annotate-dllimport-libraryimport-support

Conversation

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Annotates the platform-specific DllImport / LibraryImport / UnmanagedCallersOnly declarations under src/libraries/Common/src/Interop/Windows/** with [SupportedOSPlatform("windows")], and annotates or gates their callers accordingly.

This lets the wasm CoreCLR P/Invoke scan (PInvokeCollector) skip these declarations on browser/wasi — removing WASM0066 noise at the source — and makes them visible to CA1416 platform-compatibility analysis.

Contributes to #132776

Scope

  • Windows interop only — all 38 modules under src/libraries/Common/src/Interop/Windows/. Unix/macOS interop is not part of this change.
  • The attribute is guarded with #if NET so the shared files still compile for netstandard/netfx consumers (e.g. TestUtilities on net481), where SupportedOSPlatformAttribute does not exist.

Approach

  • Declarations. Every Windows P/Invoke / UnmanagedCallersOnly declaration is annotated. Type-level (coarse) annotation is used on the Interop. partial class where safe; per-method annotation is used where a module's const/struct/enum members are consumed by cross-platform code — e.g. the public enums in System.Net.Primitives (SslProtocols, SocketError, …) whose values derive from Interop.SChannel.* / Interop.Winsock.* / Interop.Crypt32.* — so those members stay platform-neutral. Kernel32, Advapi32, Crypt32, BCrypt, and WinSock are per-method; the remaining modules are type-level.
  • Managed wrapper helpers. A helper that calls an annotated P/Invoke is itself annotated [SupportedOSPlatform("windows")] whenever all of its callers are Windows-only, rather than suppressing the warning with a pragma. A #pragma warning disable CA1416 is used only where the requirement cannot be expressed as an annotation: (1) Windows-only-compiled implementation files (*.Windows.cs) whose members are invoked by their cross-platform partial siblings, and (2) the few helpers whose managed entry point is genuinely cross-platform — Interop.GetRandomBytes (the platform-abstracted RNG) and Kernel32.GetMessage (reached through the portable Win32Marshal error path).
  • Callers. Cross-platform files in System.Private.CoreLib reach Windows-only interop only through compile-time gates (#if TARGET_WINDOWS, #if FEATURE_COMINTEROP, *.Windows.cs, *.Nls.cs) that CA1416 cannot observe; those files carry scoped or file-level suppressions where a Windows annotation would incorrectly propagate to portable code.

Validation

  • System.Private.CoreLib builds clean with no CA1416 diagnostics on Windows (CoreCLR and NativeAOT) and on browser/wasm.
  • Cross-platform consumers — System.Net.*, System.Security.Cryptography, System.Diagnostics.*, System.IO.*, System.Console, System.DirectoryServices.Protocols, and others — build clean across all target frameworks, including browser, wasi, unix, linux, osx, and android.
  • netstandard/net481 consumers of the shared interop build clean.

Note

This pull request was authored with GitHub Copilot.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI changed the title [WIP] Annotate DllImport/LibraryImport/UnmanagedCallersOnly with [SupportedOSPlatform] Research: scope [SupportedOSPlatform] annotation of interop declarations Aug 26, 2026
Copilot AI requested a review from pavelsavara August 26, 2026 13:22
@pavelsavara

This comment was marked as outdated.

…oreLib callers

Co-authored-by: pavelsavara <271576+pavelsavara@users.noreply.github.com>

This comment was marked as outdated.

@pavelsavara pavelsavara changed the title Research: scope [SupportedOSPlatform] annotation of interop declarations Annotate Windows interop declarations with [SupportedOSPlatform("windows")] Aug 27, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@pavelsavara

Copy link
Copy Markdown
Member

/azp run runtime-extra-platforms

@pavelsavara
pavelsavara marked this pull request as ready for review August 28, 2026 21:45
Copilot AI lite review requested due to automatic review settings August 28, 2026 21:45
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 broadly annotates Windows-specific interop declarations with [SupportedOSPlatform("windows")] and updates/gates callers (primarily via CA1416 suppressions in Windows-only or Windows-gated code) so platform-compatibility analysis and wasm P/Invoke scanning can correctly skip Windows-only entrypoints.

Changes:

  • Add [SupportedOSPlatform("windows")] annotations across Windows interop declarations under src/libraries/Common/src/Interop/Windows/** (and select other Windows-only declarations).
  • Add #pragma warning disable CA1416 (and a few scoped disable/restore blocks) in Windows-only or Windows-gated call sites across CoreLib/Common/NativeAOT.
  • Add/adjust a few Windows-only managed helpers / callbacks to carry platform annotations.

Reviewed changes

Copilot reviewed 300 out of 758 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/WindowsThreadPool.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/WaitHandle.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/TimerQueue.WindowsThreadPool.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolBoundHandle.WindowsThreadPool.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/RegisteredWaitHandle.WindowsThreadPool.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.IO.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/Mutex.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelFutex.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Security/SecureString.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeMemory.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeLibrary.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeLibrary.cs Scoped CA1416 suppression around TARGET_WINDOWS interop call
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs Scoped CA1416 suppression around TARGET_WINDOWS COM interop
src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/IO/PathHelper.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEntry.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/IO/DriveInfoInternal.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/IO/Directory.Windows.cs File-level CA1416 suppression for Windows implementation called by cross-platform partial
src/libraries/System.Private.CoreLib/src/System/Guid.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.Nls.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Nls.cs File-level CA1416 suppression for Windows-only NLS interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/IdnMapping.Nls.cs File-level CA1416 suppression for Windows-only NLS interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Nls.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Nls.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Nls.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/Environment.Variables.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/RuntimeEventSourceHelper.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Stopwatch.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/System/DateTime.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/libraries/System.Private.CoreLib/src/System/AppDomain.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs File-level CA1416 suppression for Windows-only registry interop usage
src/libraries/System.Private.CoreLib/src/Internal/Win32/RegistryKey.cs File-level CA1416 suppression for Windows-only registry interop usage
src/libraries/System.Private.CoreLib/src/Internal/Console.Windows.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs Add SupportedOSPlatform to UnmanagedCallersOnly callback
src/libraries/System.Data.OleDb/src/UnsafeNativeMethods.COMWrappers.cs Add SupportedOSPlatform to Windows-only LibraryImport
src/libraries/Common/src/System/Threading/AsyncOverSyncWithIoCancellation.cs Add SupportedOSPlatform to Windows-only helper type
src/libraries/Common/src/System/IO/FileSystem.DirectoryCreation.Windows.cs File-level CA1416 suppression for Windows implementation invoked by cross-platform partial
src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs File-level CA1416 suppression for Windows implementation invoked by cross-platform partial
src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeTokenHandle.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeThreadHandle.cs File-level CA1416 suppression for Windows-gated interop usage
src/libraries/Common/src/Interop/Windows/WtsApi32/Interop.WTSUnRegisterSessionNotification.cs Mark WtsApi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/WtsApi32/Interop.WTSRegisterSessionNotification.cs Mark WtsApi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/WtsApi32/Interop.Constants.cs Mark WtsApi32 constants as Windows-only
src/libraries/Common/src/Interop/Windows/Wldap32/Interop.Ldap.cs Mark Wldap32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Wldap32/Interop.Ber.cs Mark Wldap32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Wkscli/Interop.NetWkstaGetInfo.cs Mark Wkscli interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSARecv.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSAConnect.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.shutdown.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.sendto.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.send.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.recvfrom.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.recv.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.listen.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.getsockname.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.getpeername.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.gethostname.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.closesocket.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.bind.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinSock/Interop.accept.cs Mark Winsock P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutWrite.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutRestart.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutReset.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutPrepareHeader.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutPause.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutOpen.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutGetNumDevs.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutGetDevCaps.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutClose.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.PlaySound.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.MMSYSERR.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioRead.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioOpen.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioDescend.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioClose.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioAscend.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinMm/Interop.MMCKINFO.cs Mark WinMM interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp.cs Mark WinHTTP interop as Windows-only
src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs Mark WinHTTP types/constants as Windows-only
src/libraries/Common/src/Interop/Windows/WinHttp/Interop.SafeWinHttpHandle.cs Mark WinHTTP safe handle as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketSend.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketReceive.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketGetAction.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketEndServerHandshake.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketDeleteHandle.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateServerHandle.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateClientHandle.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCompleteAction.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginServerHandshake.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginClientHandshake.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketAbortHandle.cs Mark Windows WebSocket interop as Windows-only
src/libraries/Common/src/Interop/Windows/WebSocket/Interop.Structs.cs Mark Windows WebSocket structs as Windows-only
src/libraries/Common/src/Interop/Windows/Version/Interop.VSFixedFileInfo.cs Mark Version interop structs as Windows-only
src/libraries/Common/src/Interop/Windows/Version/Interop.VerQueryValue.cs Mark Version interop as Windows-only
src/libraries/Common/src/Interop/Windows/Version/Interop.GetFileVersionInfoSizeEx.cs Mark Version interop as Windows-only
src/libraries/Common/src/Interop/Windows/Version/Interop.GetFileVersionInfoEx.cs Mark Version interop as Windows-only
src/libraries/Common/src/Interop/Windows/Version/Interop.FileVersionInfoType.cs Mark Version interop as Windows-only
src/libraries/Common/src/Interop/Windows/Version/Interop.FileVersionInfo.cs Mark Version interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.WndProc.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.WNDCLASS.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.Win32SystemColors.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.WaitForInputIdle.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.USEROBJECTFLAGS.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.UnregisterClass.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.TranslateMessage.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SystemParametersInfo.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SetWindowLongPtr.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SetWindowLong.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SetTimer.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SetClassLongPtr.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SetClassLong.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SendMessageTimeout.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.SendMessage.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.RegisterWindowMessage.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.RegisterClass.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.PostQuitMessage.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.PostMessage.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.MsgWaitForMultipleObjectsEx.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.MSG.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.MessageBeep.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.LoadString.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.KillTimer.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.IsWindowVisible.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.IsWindow.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.HIGHCONTRASTW.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetWindowThreadProcessId.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetWindowTextW.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetWindowTextLengthW.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetWindowLong.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetWindow.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetUserObjectInformation.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetSysColor.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetProcessWindowStation.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetMessage.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetKeyState.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.GetClassInfo.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.FindWindow.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.EnumWindows.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.DispatchMessage.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.DestroyWindow.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.DefWindowProc.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.CreateWindowEx.cs Mark User32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/User32/Interop.Constants.cs Mark User32 constants as Windows-only
src/libraries/Common/src/Interop/Windows/Ucrtbase/Interop.MemAlloc.cs Mark ucrtbase interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/NegotiationInfoClass.cs Mark SspiCli helper as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.TokenSource.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SecurityLogonType.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.QuotaLimits.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.LsaLookupAuthenticationPackage.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.LsaLogonUser.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.LsaGetLogonSessionData.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.LsaFreeReturnBuffer.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.LsaDeregisterLogonProcess.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.LsaConnectUntrusted.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.KerbS4uLogin.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.KerbLogonSubmitType.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.AuthenticationPackageNames.cs Mark SspiCli interop as Windows-only
src/libraries/Common/src/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs Mark Shell32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Shell32/Interop.ShellExecuteExW.cs Mark Shell32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Secur32/Interop.LsaLogonProcessSafeHandle.cs Mark Secur32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Secur32/Interop.LsaFreeReturnBuffer.cs Mark Secur32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Secur32/Interop.LsaDeregisterLogonProcess.cs Mark Secur32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Secur32/Interop.LsaConnectUntrusted.cs Mark Secur32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Secur32/Interop.LsaCallAuthenticationPackage.cs Mark Secur32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Secur32/Interop.GetUserNameExW.cs Mark Secur32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/PerfCounter/Interop.PerformanceData.cs Mark PerfCounter interop as Windows-only
src/libraries/Common/src/Interop/Windows/Pdh/Interop.PdhFormatFromRawValue.cs Mark PDH interop as Windows-only
src/libraries/Common/src/Interop/Windows/OleAut32/Interop.VariantClear.cs Mark OleAut32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/OleAut32/Interop.VariantChangeTypeEx.cs Mark OleAut32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SysFreeString.cs Mark OleAut32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs Mark OleAut32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs Mark OleAut32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SetErrorInfo.cs Mark OleAut32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/OleAut32/Interop.GetErrorInfo.cs Mark OleAut32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.PropVariantClear.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoUninitialize.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoInitializeEx.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetStandardMarshal.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetObjectContext.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetContextToken.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetApartmentType.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoCreateGuid.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Ole32/Interop.CLSIDFromProgID.cs Mark Ole32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.SYSTEM_PROCESS_INFORMATION.cs Mark NtDll interop types as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.SYSTEM_LEAP_SECOND_INFORMATION.cs Mark NtDll interop types as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.RtlNtStatusToDosError.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.RtlInitUnicodeString.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.RtlGetVersion.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.PROCESS_BASIC_INFORMATION.cs Mark NtDll interop types as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryInformationProcess.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryDirectoryFile.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtCreateFile.cs Mark NtDll interop as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.IO_STATUS_BLOCK.cs Mark NtDll interop types as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.FILE_INFORMATION_CLASS.cs Mark NtDll interop types as Windows-only
src/libraries/Common/src/Interop/Windows/NtDll/Interop.FILE_FULL_DIR_INFORMATION.cs Mark NtDll interop types as Windows-only
src/libraries/Common/src/Interop/Windows/Normaliz/Interop.Normalization.cs Mark Normaliz interop as Windows-only
src/libraries/Common/src/Interop/Windows/Normaliz/Interop.Idna.cs Mark Normaliz interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netutils/Interop.NetApiBufferFree.cs Mark Netutils interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.NetApiBufferFree.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.I_NetLogonControl2.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsRoleGetPrimaryDomainInformation.cs Mark Netapi32 types as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsRoleFreeMemory.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsGetSiteName.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsGetDcOpen.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsGetDcNext.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsGetDcName.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsGetDcClose.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DsEnumerateDomainTrustsW.cs Mark Netapi32 interop as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DS_DOMAINTRUST_FLAG.cs Mark Netapi32 types as Windows-only
src/libraries/Common/src/Interop/Windows/Netapi32/Interop.DS_DOMAIN_TRUSTS.cs Mark Netapi32 types as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.UiPolicy.cs Mark NCrypt interop types as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.SignVerify.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Properties.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptOpenStorageProvider.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptFreeObject.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptDeriveSecretAgreement.cs Mark NCrypt interop types as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptDeriveKeyMaterial.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptDecapsulateEncapsulate.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptBuffer.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Keys.cs Mark NCrypt constants as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.ErrorCode.cs Mark NCrypt types as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.EncryptDecrypt.cs Mark NCrypt interop as Windows-only
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.AsymmetricPaddingMode.cs Mark NCrypt types as Windows-only
src/libraries/Common/src/Interop/Windows/Mincore/Interop.WaitOnAddress.cs Mark Mincore interop as Windows-only
src/libraries/Common/src/Interop/Windows/Logoncli/Interop.DsGetDcName.cs Mark Logoncli interop as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_IntPtr.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WaitCommEvent.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.VirtualQuery.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.Sleep.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetupComm.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetLastError.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetCommState.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetCommMask.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetCommBreak.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ResumeThread.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_IntPtr.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.PurgeComm.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetUserDefaultLCID.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetTickCount64.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetThreadPriority.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetSystemTime.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetStdHandle.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetProcessId.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetPriorityClass.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetNativeSystemInfo.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetLastError.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCurrentThread.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCurrentProcessorNumberEx.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCurrentProcess.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCPInfo.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleTitle.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleOutputCP.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleCP.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCommState.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCommProperties.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCommandLine.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FreeLibrary.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FindClose.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ExitProcess.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EscapeCommFunction.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CopyFile.cs Mark Kernel32 helper as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CloseHandle.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ClearCommBreak.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.Beep.cs Mark Kernel32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.NetworkInformation.cs Mark IpHlpApi interop as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.IP_ADDR_STRING.cs Mark IpHlpApi structs as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ICMP.cs Mark IpHlpApi types/constants as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.GetNetworkParams.cs Mark IpHlpApi P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.FIXED_INFO.cs Mark IpHlpApi structs as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ErrorCodes.cs Mark IpHlpApi constants as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ConvertInterfaceNameToLuid.cs Mark IpHlpApi P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ConvertInterfaceLuidToName.cs Mark IpHlpApi P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ConvertInterfaceLuidToIndex.cs Mark IpHlpApi P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ConvertInterfaceIndexToLuid.cs Mark IpHlpApi P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/HttpApi/Interop.HttpApi.cs Mark HttpApi interop as Windows-only
src/libraries/Common/src/Interop/Windows/HttpApi/Interop.ErrorCodes.cs Mark HttpApi constants as Windows-only
src/libraries/Common/src/Interop/Windows/Dsrole/Interop.DsRoleGetPrimaryDomainInformation.cs Mark Dsrole types as Windows-only
src/libraries/Common/src/Interop/Windows/Dsrole/Interop.DsRoleFreeMemory.cs Mark Dsrole P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Dnsapi/Interop.DnsTypes.cs Mark Dnsapi types as Windows-only
src/libraries/Common/src/Interop/Windows/Dnsapi/Interop.DnsApi.cs Mark Dnsapi interop as Windows-only
src/libraries/Common/src/Interop/Windows/CryptUI/Interop.CryptUIDlgCertificate.cs Mark CryptUI interop as Windows-only
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject.cs Mark Crypt32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObject.cs Mark Crypt32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Credui/Interop.CredUIParseUserName.cs Mark Credui interop as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptVerifySignature.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptSignHash.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptSecretAgreement.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs File-level CA1416 suppression for cross-platform RNG entrypoint
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptFinalizeKey.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptDuplicateHash.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptDestroySecret.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptDestroyKey.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptDestroyHash.cs Mark BCrypt P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Authz/Interop.AuthzInitializeResourceManager.cs Mark Authz interop as Windows-only
src/libraries/Common/src/Interop/Windows/Authz/Interop.AuthzInitializeContextFromSid.cs Mark Authz interop as Windows-only
src/libraries/Common/src/Interop/Windows/Authz/Interop.AuthzGetInformationFromContext.cs Mark Authz interop as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegFlushKey.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegCloseKey.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.GetSecurityDescriptorLength.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.GetLengthSid.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EventWriteString.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EventUnregister.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EventSetInformation.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EventRegister.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptEncrypt.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDecrypt.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptCreateHash.cs Mark Advapi32 P/Invoke as Windows-only
src/libraries/Common/src/Interop/Windows/Activeds/Interop.FreeADsMem.cs Mark Activeds interop as Windows-only
src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsSetLastError.cs Mark Activeds interop as Windows-only
src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsOpenObject.cs Mark Activeds interop as Windows-only
src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsGetLastError.cs Mark Activeds interop as Windows-only
src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsEncodeBinaryData.cs Mark Activeds interop as Windows-only
src/coreclr/System.Private.CoreLib/src/Microsoft/Win32/OAVariantLib.cs File-level CA1416 suppression for Windows-only OLE Automation interop
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.NativeAot.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Environment.NativeAot.Windows.cs File-level CA1416 suppression for Windows-only interop usage
src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/FrozenObjectHeapManager.Windows.cs File-level CA1416 suppression for Windows-only interop usage

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 29, 2026 08:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Review details
  • Files reviewed: 300/758 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

#if TARGET_WINDOWS
private static unsafe IntPtr GetProcAddressWithMangling(IntPtr hModule, byte* methodName, MethodFixupCell* pCell)
{
#pragma warning disable CA1416 // Only reached on Windows via TARGET_WINDOWS.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need suppressions like this? Is this a bug in the analyzer? Can you link the bug so we can delete these once the bug is fixed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The platform neutral CoreLib is compiled with MSBuild TargetOS set to the same platform as the machine doing the compilation.
Therefore TargetsWindows is true.
Therefore #if TARGET_WINDOWS is true, not false.

As a consequence, platform neutral CoreLib has those calls included and we get the CA1416.

Any idea what to do with that would be appreciated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is platform neutral corelib? Where/how do we build it and what's the purpose?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sorry, "neutral corelib" is wrong angle. And maybe I'm confused about TargetsWindows values.

It's those Windows P/Invokes sit in the unconditionally-compiled part of CoreLib, so they land in every CoreLib flavor including browser.

The NLS/Normaliz declarations aren't under TargetsWindows at all — they're unconditional.

@MichalStrehovsky

Copy link
Copy Markdown
Member

This lets the wasm CoreCLR P/Invoke scan (PInvokeCollector) skip these declarations on browser/wasi — removing WASM0066 noise at the source — and makes them visible to CA1416 platform-compatibility analysis.

How are we ending up with these DllImports under WASM in the first place? I would have expect us not to compile these in the first place under WASM. And why Windows specifically and not macOS/Linux?

@pavelsavara

Copy link
Copy Markdown
Member

How are we ending up with these DllImports under WASM in the first place?

Platform neutral CoreLib contains windows calls.

And why Windows specifically and not macOS/Linux?

I think we ship the runtime pack from windows machine.

This PR focuses on Windows only and I think we need to annotate OSX and Unix too (for consistency).

I just wanted to do that in a separate PRs.

@pavelsavara
pavelsavara marked this pull request as draft August 31, 2026 18:30
@MichalStrehovsky

Copy link
Copy Markdown
Member

How are we ending up with these DllImports under WASM in the first place?

Platform neutral CoreLib contains windows calls.

Can you point me to one? I tried building build.cmd clr.corelib -rc Release -os browser -arch wasm and I don't see any Windows imports. ILSpy says:

Referenced assemblies (in metadata order):
libSystem.Globalization.Native
contains no metadata
libSystem.Native
contains no metadata
libSystem.Native.Browser
contains no metadata
QCall
contains no metadata

Could there be some confusion about the APIs that CoreCLR ships an emulator for? For example, your PR is marking this one as Windows-only:

internal static partial class Kernel32
{
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[LibraryImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentVariableW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
internal static partial uint GetEnvironmentVariable(string lpName, ref char lpBuffer, uint nSize);
}
}

However, we define Kernel32 to QCall on non-Windows:

{
internal const string Kernel32 = RuntimeHelpers.QCall;
}

So this is in fact not Windows-specific and works fine outside Windows (it binds to CoreCLR's Win32 API emulator).

@MichalStrehovsky

Copy link
Copy Markdown
Member

Maybe the fix you need is to make the tooling ignore QCall DllImports?

@pavelsavara

Copy link
Copy Markdown
Member

@MichalStrehovsky it's quite possible my problem is hallucination/bug from some of my R2R branches where I mixed windows and browser CoreLib in some msbuild hell. Right now I can't see any windows Pinvoke in IL Trimmed browser corelib.

Before I realized that, I also tried to follow your advice and eliminate more of the windows files on this branch.

It's probably the right thing to do, but I don't want to waste your time until I'm clear what and why I need.
Thanks for your hits so far.

@pavelsavara pavelsavara closed this Sep 1, 2026
@pavelsavara

Copy link
Copy Markdown
Member

They are real, I don't know the root cause yet.

https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1578162&view=logs&jobId=1132506b-0c49-5a1f-b2bd-bd1092700f59

##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'Microsoft.Diagnostics.Runtime.WindowsProcessDataReader::EnumProcessModules' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'Microsoft.Diagnostics.Runtime.WindowsProcessDataReader::EnumProcessModules' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'Microsoft.Diagnostics.Runtime.WindowsProcessDataReader::GetModuleFileNameEx' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'Microsoft.Diagnostics.Runtime.WindowsProcessDataReader::GetModuleFileNameEx' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'advapi32.dll' for method 'Interop+Advapi32::<GetTokenInformation>g____PInvoke|2_0' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+OpenSsl::OpenSslVersionNumber' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+OpenSsl::OpenSslVersionNumber' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+OpenSsl::OpenSslGetProtocolSupport' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+OpenSsl::OpenSslGetProtocolSupport' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+CryptoInitializer::EnsureOpenSslInitialized' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+CryptoInitializer::EnsureOpenSslInitialized' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+OpenSslNoInit::OpenSslAvailable' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.OpenSsl' for method 'Interop+OpenSslNoInit::OpenSslAvailable' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.Android' for method 'Interop+AndroidCrypto::SSLGetSupportedProtocols' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.Android' for method 'Interop+AndroidCrypto::SSLGetSupportedProtocols' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.Android' for method 'Interop+AndroidCrypto::<SSLSupportsApplicationProtocolsConfiguration>g____PInvoke|1_0' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libSystem.Security.Cryptography.Native.Android' for method 'Interop+AndroidCrypto::<SSLSupportsApplicationProtocolsConfiguration>g____PInvoke|1_0' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.PlatformDetection::<GetProductInfo>g____PInvoke|544_0' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.PlatformDetection::<GetProductInfo>g____PInvoke|544_0' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.PlatformDetection::<GetCurrentApplicationUserModelId>g____PInvoke|545_0' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.PlatformDetection::<GetCurrentApplicationUserModelId>g____PInvoke|545_0' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libc' for method 'System.PlatformDetection+libc::gnu_get_libc_release' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libc' for method 'System.PlatformDetection+libc::gnu_get_libc_release' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libc' for method 'System.PlatformDetection+libc::gnu_get_libc_version' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libc' for method 'System.PlatformDetection+libc::gnu_get_libc_version' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Buffers.BoundedMemory+UnsafeNativeMethods::VirtualAlloc' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Buffers.BoundedMemory+UnsafeNativeMethods::VirtualAlloc' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Buffers.BoundedMemory+UnsafeNativeMethods::VirtualFree' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Buffers.BoundedMemory+UnsafeNativeMethods::VirtualFree' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Buffers.BoundedMemory+UnsafeNativeMethods::VirtualProtect' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Buffers.BoundedMemory+UnsafeNativeMethods::VirtualProtect' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Runtime.ExceptionServices.Tests.HandleProcessCorruptedStateExceptionsTests::RaiseException' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Runtime.ExceptionServices.Tests.HandleProcessCorruptedStateExceptionsTests::RaiseException' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Runtime.ExceptionServices.Tests.HandleProcessCorruptedStateExceptionsTests::SetErrorMode' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'kernel32.dll' for method 'System.Runtime.ExceptionServices.Tests.HandleProcessCorruptedStateExceptionsTests::SetErrorMode' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'Kernel32.dll' for method 'System.Tests.DateTimeTests::GetSystemTime' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'Kernel32.dll' for method 'System.Tests.DateTimeTests::GetSystemTime' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'nonexistent' for method 'System.Tests.PseudoCustomAttributeTests+TestTypeWithAttributes::TestMethod' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'nonexistent' for method 'System.Tests.PseudoCustomAttributeTests+TestTypeWithAttributes::TestMethod' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]
##[error]src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libc' for method 'System.Tests.ExitCodeTests::kill' is not in the list of allowed modules. It is also not a specially treated module.
/__w/1/s/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets(691,5): error WASM0066: PInvoke module 'libc' for method 'System.Tests.ExitCodeTests::kill' is not in the list of allowed modules. It is also not a specially treated module. [/__w/1/s/src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj::TargetFramework=net11.0-browser]

@MichalStrehovsky

Copy link
Copy Markdown
Member

They are real, I don't know the root cause yet.

Doesn't look to be from product code, it's from test code. Looks to be coming from https://github.com/microsoft/clrmd/tree/main/src/Microsoft.Diagnostics.Runtime and p/invokes the test itself is doing. Why is this a build error? Can it just leave a p/invoke that doesn't work? (I would not even warn, patterns like this are common and the code is usually not reachable at runtime on inapplicable platforms - there is a runtime check.)

@pavelsavara

Copy link
Copy Markdown
Member

They are DLLImports in TestUtilities and System.Runtime.Tests, so not in the product.

@MichalStrehovsky

Copy link
Copy Markdown
Member

They are DLLImports in TestUtilities and System.Runtime.Tests, so not in the product.

But why is an unresolvable DllImport a build error? That sounds problematic, people often ship platform neutral NuGets that handle several platforms (and some DllImports are therefore there, but unreachable in practice, might not be trimmable in practice either).

@MichalPetryka

Copy link
Copy Markdown
Contributor

They are DLLImports in TestUtilities and System.Runtime.Tests, so not in the product.

But why is an unresolvable DllImport a build error? That sounds problematic, people often ship platform neutral NuGets that handle several platforms (and some DllImports are therefore there, but unreachable in practice, might not be trimmable in practice either).

Some libs in fact even try-catch to check for the lib too.

@pavelsavara

Copy link
Copy Markdown
Member

It's a warning and we treat warnings as errors.
We will drop that warning completely in #131877 so it will be gone soon.

It drove me crazy, because we had un-trimmed PInvoke in browser runtime pack in the past.

To stay sane I wrote #133128 today. I'm not sure if we will land all of it.

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.

Annotate all DllImport/LibraryImport/UnmanagedCallersOnly with [SupportedOSPlatform]

5 participants