mark Windows-specific APIs as such (#39265)
authorAdam Sitnik <adam.sitnik@gmail.com>
Fri, 17 Jul 2020 13:11:50 +0000 (15:11 +0200)
committerGitHub <noreply@github.com>
Fri, 17 Jul 2020 13:11:50 +0000 (15:11 +0200)
commit52d4d8c057d24a77b2cf6708d495cf549a8bee9a
treeb1c0bd516a17bc6df08db4f0111f67257089fcfe
parent2a1595eb83ec3b520d18b44236ae265d5a433640
mark Windows-specific APIs as such (#39265)

* move all OSPlatformAttributes to a single file so they can be easily referenced in < .NET 5 libraries

* Adds System.Runtime.Versioning*Platform* annotation attributes to < .NET 5 builds

* introduce MinimiumSupportedWindowsPlatform

* introduce IsWindowsSpecific setting that adds MinimumOSPlatform attribute for Windows Specific libraries

* mark all Windows-specific libraries as such

* annotate Windows-specific System.Console methods and properites

* annotate Windows-specific DpapiProtectedConfigurationProvider type

* annotate throwing Windows-specific APIs from System.Diagnostics.Process namespace

* annotate throwing Windows-specific APIs from System.IO.MemoryMappedFiles namespace

* annotate Windows-specific APIs from System.IO.Pipes namespace

* the new attributes should support enums

* annotate Windows-specific APIs from HttpListenerTimeoutManager class

* annotate Windows-specific APIs from System.Net.Sockets namespace

* annotate Windows-specific APIs from System.Runtime.InteropServices namespace

* annotate Windows-specific APIs from System.Security.Cryptography.Csp namespace

* annotate Windows-specific APIs from System.Security.Cryptography.X509Certificates namespace

* annotate Windows-specific APIs from System.Threading namespace

* address code review feedback: dont introduce new constants, reuse existing SYSTEM_PRIVATE_CORELIB

* code review: import the namespace, simplify the attribute name

* add missing Socket.DuplicateAndClose and Socket(SocketInformation)

* fix the test name (it does not throw)

* add missing DriveInfo.set_VolumeLabel

* add System.IO.FileSystem File Encrypt and Descrypt methods

* simplify the < .NET 5 check

* enable nullable in explicit way as it's not enabled in all the projects where this file is included

* include platform attributes in projects that ask for it in explicit way

* set IncludePlatformAttributes to true for projects that include files from other projects

* use suggestions from Viktor and Santi

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
101 files changed:
eng/Configurations.props
eng/versioning.targets
src/libraries/Directory.Build.targets
src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj
src/libraries/Microsoft.Win32.Registry.AccessControl/Directory.Build.props
src/libraries/Microsoft.Win32.Registry/Directory.Build.props
src/libraries/Microsoft.Win32.SystemEvents/Directory.Build.props
src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props
src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs
src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/DpapiProtectedConfigurationProvider.cs
src/libraries/System.Console/Directory.Build.props
src/libraries/System.Console/ref/System.Console.cs
src/libraries/System.Console/src/System/Console.cs
src/libraries/System.Diagnostics.EventLog/Directory.Build.props
src/libraries/System.Diagnostics.PerformanceCounter/Directory.Build.props
src/libraries/System.Diagnostics.Process/Directory.Build.props
src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Windows.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Unix.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs
src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs
src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props
src/libraries/System.DirectoryServices/Directory.Build.props
src/libraries/System.IO.FileSystem.AccessControl/Directory.Build.props
src/libraries/System.IO.FileSystem.DriveInfo/Directory.Build.props
src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.cs
src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.UnixOrBrowser.cs
src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs
src/libraries/System.IO.FileSystem/Directory.Build.props
src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs
src/libraries/System.IO.FileSystem/src/System/IO/File.cs
src/libraries/System.IO.MemoryMappedFiles/Directory.Build.props
src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs
src/libraries/System.IO.Pipes.AccessControl/Directory.Build.props
src/libraries/System.IO.Pipes/Directory.Build.props
src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs
src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Unix.cs
src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs
src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs
src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs
src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeTransmissionMode.cs
src/libraries/System.Management/Directory.Build.props
src/libraries/System.Net.Http.WinHttpHandler/Directory.Build.props
src/libraries/System.Net.HttpListener/Directory.Build.props
src/libraries/System.Net.HttpListener/ref/System.Net.HttpListener.cs
src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerTimeoutManager.Managed.cs
src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerTimeoutManager.Windows.cs
src/libraries/System.Net.Sockets/Directory.Build.props
src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/IOControlCode.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Unix.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/TCPListener.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/TransmitFileOptions.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/UDPClient.cs
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/MinimumOSPlatformAttribute.cs [deleted file]
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/OSPlatformAttribute.cs [deleted file]
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/ObsoletedInOSPlatformAttribute.cs [deleted file]
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/RemovedInOSPlatformAttribute.cs [deleted file]
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/TargetPlatformAttribute.cs [deleted file]
src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs
src/libraries/System.Runtime.InteropServices/Directory.Build.props
src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
src/libraries/System.Security.AccessControl/Directory.Build.props
src/libraries/System.Security.Cryptography.Cng/Directory.Build.props
src/libraries/System.Security.Cryptography.Csp/Directory.Build.props
src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Unix.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Windows.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Unix.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Windows.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs
src/libraries/System.Security.Cryptography.ProtectedData/Directory.Build.props
src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props
src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs
src/libraries/System.Security.Principal.Windows/Directory.Build.props
src/libraries/System.ServiceProcess.ServiceController/Directory.Build.props
src/libraries/System.Threading.AccessControl/Directory.Build.props
src/libraries/System.Threading.Overlapped/Directory.Build.props
src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs
src/libraries/System.Threading/ref/System.Threading.cs