diff --git a/eng/Configurations.props b/eng/Configurations.props index 1d6ad36e8150c6..aa8e9add17dd81 100644 --- a/eng/Configurations.props +++ b/eng/Configurations.props @@ -31,6 +31,7 @@ .NET $(NetCoreAppCurrentVersion) net472 + WINDOWS7.0 diff --git a/eng/versioning.targets b/eng/versioning.targets index c907b58691265c..1eba158bb6beae 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -22,6 +22,13 @@ + + + + <_Parameter1>$(MinimiumSupportedWindowsPlatform) + + + diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index 48dc86d6086bc3..bf87a4ecc83ac3 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -226,9 +226,6 @@ - - $(DefineConstants),INTERNAL_NULLABLE_ATTRIBUTES - @@ -240,6 +237,15 @@ true + + + + + + + + + diff --git a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj index 5e8d6bcfed8545..496290041a2725 100644 --- a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj +++ b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj @@ -6,6 +6,7 @@ true false annotations + true Microsoft + true \ No newline at end of file diff --git a/src/libraries/Microsoft.Win32.Registry/Directory.Build.props b/src/libraries/Microsoft.Win32.Registry/Directory.Build.props index 8c72c62fd5932e..27a4a5522a2778 100644 --- a/src/libraries/Microsoft.Win32.Registry/Directory.Build.props +++ b/src/libraries/Microsoft.Win32.Registry/Directory.Build.props @@ -4,5 +4,6 @@ Microsoft true false + true \ No newline at end of file diff --git a/src/libraries/Microsoft.Win32.SystemEvents/Directory.Build.props b/src/libraries/Microsoft.Win32.SystemEvents/Directory.Build.props index bdcfca3b543cbb..2f8a8940e012a3 100644 --- a/src/libraries/Microsoft.Win32.SystemEvents/Directory.Build.props +++ b/src/libraries/Microsoft.Win32.SystemEvents/Directory.Build.props @@ -2,5 +2,6 @@ Open + true \ No newline at end of file diff --git a/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props b/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props index bdcfca3b543cbb..1db5968484c1ec 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props +++ b/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props @@ -2,5 +2,6 @@ Open + true \ No newline at end of file diff --git a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs index 95a27a21228673..df967acbbdfb20 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs @@ -607,6 +607,7 @@ public DictionarySectionHandler() { } protected virtual string ValueAttributeName { get { throw null; } } public virtual object Create(object parent, object context, System.Xml.XmlNode section) { throw null; } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public sealed partial class DpapiProtectedConfigurationProvider : System.Configuration.ProtectedConfigurationProvider { public DpapiProtectedConfigurationProvider() { } diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/DpapiProtectedConfigurationProvider.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/DpapiProtectedConfigurationProvider.cs index 7673dab216033b..b6ada8acbfefa9 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/DpapiProtectedConfigurationProvider.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/DpapiProtectedConfigurationProvider.cs @@ -5,9 +5,11 @@ using System.Security.Cryptography; using System.Text; using System.Xml; +using System.Runtime.Versioning; namespace System.Configuration { + [MinimumOSPlatform("windows7.0")] public sealed class DpapiProtectedConfigurationProvider : ProtectedConfigurationProvider { private bool _useMachineProtection = true; diff --git a/src/libraries/System.Console/Directory.Build.props b/src/libraries/System.Console/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.Console/Directory.Build.props +++ b/src/libraries/System.Console/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.Console/ref/System.Console.cs b/src/libraries/System.Console/ref/System.Console.cs index 98f8027794d781..20b7d335e046ef 100644 --- a/src/libraries/System.Console/ref/System.Console.cs +++ b/src/libraries/System.Console/ref/System.Console.cs @@ -9,16 +9,16 @@ namespace System public static partial class Console { public static System.ConsoleColor BackgroundColor { get { throw null; } set { } } - public static int BufferHeight { get { throw null; } set { } } - public static int BufferWidth { get { throw null; } set { } } + public static int BufferHeight { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + public static int BufferWidth { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static bool CapsLock { get { throw null; } } public static int CursorLeft { get { throw null; } set { } } - public static int CursorSize { get { throw null; } set { } } + public static int CursorSize { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } public static int CursorTop { get { throw null; } set { } } - public static bool CursorVisible { get { throw null; } set { } } + public static bool CursorVisible { [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] get { throw null; } set { } } public static System.IO.TextWriter Error { get { throw null; } } public static System.ConsoleColor ForegroundColor { get { throw null; } set { } } - public static (int Left, int Top) GetCursorPosition() { throw null; } public static System.IO.TextReader In { get { throw null; } } public static System.Text.Encoding InputEncoding { get { throw null; } set { } } public static bool IsErrorRedirected { get { throw null; } } @@ -27,20 +27,25 @@ public static partial class Console public static bool KeyAvailable { get { throw null; } } public static int LargestWindowHeight { get { throw null; } } public static int LargestWindowWidth { get { throw null; } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static bool NumberLock { get { throw null; } } public static System.IO.TextWriter Out { get { throw null; } } public static System.Text.Encoding OutputEncoding { get { throw null; } set { } } - public static string Title { get { throw null; } set { } } + public static string Title { [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] get { throw null; } set { } } public static bool TreatControlCAsInput { get { throw null; } set { } } - public static int WindowHeight { get { throw null; } set { } } - public static int WindowLeft { get { throw null; } set { } } - public static int WindowTop { get { throw null; } set { } } - public static int WindowWidth { get { throw null; } set { } } + public static int WindowHeight { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + public static int WindowLeft { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + public static int WindowTop { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + public static int WindowWidth { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } public static event System.ConsoleCancelEventHandler? CancelKeyPress { add { } remove { } } public static void Beep() { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void Beep(int frequency, int duration) { } public static void Clear() { } + public static (int Left, int Top) GetCursorPosition() { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, System.ConsoleColor sourceForeColor, System.ConsoleColor sourceBackColor) { } public static System.IO.Stream OpenStandardError() { throw null; } public static System.IO.Stream OpenStandardError(int bufferSize) { throw null; } @@ -53,12 +58,15 @@ public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth public static System.ConsoleKeyInfo ReadKey(bool intercept) { throw null; } public static string? ReadLine() { throw null; } public static void ResetColor() { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void SetBufferSize(int width, int height) { } public static void SetCursorPosition(int left, int top) { } public static void SetError(System.IO.TextWriter newError) { } public static void SetIn(System.IO.TextReader newIn) { } public static void SetOut(System.IO.TextWriter newOut) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void SetWindowPosition(int left, int top) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void SetWindowSize(int width, int height) { } public static void Write(bool value) { } public static void Write(char value) { } diff --git a/src/libraries/System.Console/src/System/Console.cs b/src/libraries/System.Console/src/System/Console.cs index 1cf8bdc6aae4f5..ed25ffe8599fad 100644 --- a/src/libraries/System.Console/src/System/Console.cs +++ b/src/libraries/System.Console/src/System/Console.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.IO; using System.Runtime.CompilerServices; +using System.Runtime.Versioning; using System.Text; using System.Threading; @@ -277,14 +277,17 @@ static StrongBox EnsureInitialized() public static int CursorSize { get { return ConsolePal.CursorSize; } + [MinimumOSPlatform("windows7.0")] set { ConsolePal.CursorSize = value; } } + [MinimumOSPlatform("windows7.0")] public static bool NumberLock { get { return ConsolePal.NumberLock; } } + [MinimumOSPlatform("windows7.0")] public static bool CapsLock { get { return ConsolePal.CapsLock; } @@ -312,15 +315,18 @@ public static void ResetColor() public static int BufferWidth { get { return ConsolePal.BufferWidth; } + [MinimumOSPlatform("windows7.0")] set { ConsolePal.BufferWidth = value; } } public static int BufferHeight { get { return ConsolePal.BufferHeight; } + [MinimumOSPlatform("windows7.0")] set { ConsolePal.BufferHeight = value; } } + [MinimumOSPlatform("windows7.0")] public static void SetBufferSize(int width, int height) { ConsolePal.SetBufferSize(width, height); @@ -329,32 +335,38 @@ public static void SetBufferSize(int width, int height) public static int WindowLeft { get { return ConsolePal.WindowLeft; } + [MinimumOSPlatform("windows7.0")] set { ConsolePal.WindowLeft = value; } } public static int WindowTop { get { return ConsolePal.WindowTop; } + [MinimumOSPlatform("windows7.0")] set { ConsolePal.WindowTop = value; } } public static int WindowWidth { get { return ConsolePal.WindowWidth; } + [MinimumOSPlatform("windows7.0")] set { ConsolePal.WindowWidth = value; } } public static int WindowHeight { get { return ConsolePal.WindowHeight; } + [MinimumOSPlatform("windows7.0")] set { ConsolePal.WindowHeight = value; } } + [MinimumOSPlatform("windows7.0")] public static void SetWindowPosition(int left, int top) { ConsolePal.SetWindowPosition(left, top); } + [MinimumOSPlatform("windows7.0")] public static void SetWindowSize(int width, int height) { ConsolePal.SetWindowSize(width, height); @@ -372,6 +384,7 @@ public static int LargestWindowHeight public static bool CursorVisible { + [MinimumOSPlatform("windows7.0")] get { return ConsolePal.CursorVisible; } set { ConsolePal.CursorVisible = value; } } @@ -400,6 +413,7 @@ public static (int Left, int Top) GetCursorPosition() public static string Title { + [MinimumOSPlatform("windows7.0")] get { return ConsolePal.Title; } set { @@ -412,16 +426,19 @@ public static void Beep() ConsolePal.Beep(); } + [MinimumOSPlatform("windows7.0")] public static void Beep(int frequency, int duration) { ConsolePal.Beep(frequency, duration); } + [MinimumOSPlatform("windows7.0")] public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop) { ConsolePal.MoveBufferArea(sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop, ' ', ConsoleColor.Black, BackgroundColor); } + [MinimumOSPlatform("windows7.0")] public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor) { ConsolePal.MoveBufferArea(sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop, sourceChar, sourceForeColor, sourceBackColor); diff --git a/src/libraries/System.Diagnostics.EventLog/Directory.Build.props b/src/libraries/System.Diagnostics.EventLog/Directory.Build.props index bdcfca3b543cbb..2f8a8940e012a3 100644 --- a/src/libraries/System.Diagnostics.EventLog/Directory.Build.props +++ b/src/libraries/System.Diagnostics.EventLog/Directory.Build.props @@ -2,5 +2,6 @@ Open + true \ No newline at end of file diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/Directory.Build.props b/src/libraries/System.Diagnostics.PerformanceCounter/Directory.Build.props index bdcfca3b543cbb..2f8a8940e012a3 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/Directory.Build.props +++ b/src/libraries/System.Diagnostics.PerformanceCounter/Directory.Build.props @@ -2,5 +2,6 @@ Open + true \ No newline at end of file diff --git a/src/libraries/System.Diagnostics.Process/Directory.Build.props b/src/libraries/System.Diagnostics.Process/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.Diagnostics.Process/Directory.Build.props +++ b/src/libraries/System.Diagnostics.Process/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs index 2f414aac45a829..60808eea784a9a 100644 --- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs +++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs @@ -41,8 +41,8 @@ public Process() { } public System.Diagnostics.ProcessModule? MainModule { get { throw null; } } public System.IntPtr MainWindowHandle { get { throw null; } } public string MainWindowTitle { get { throw null; } } - public System.IntPtr MaxWorkingSet { get { throw null; } set { } } - public System.IntPtr MinWorkingSet { get { throw null; } set { } } + public System.IntPtr MaxWorkingSet { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + public System.IntPtr MinWorkingSet { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } public System.Diagnostics.ProcessModuleCollection Modules { get { throw null; } } [System.ObsoleteAttribute("This property has been deprecated. Please use System.Diagnostics.Process.NonpagedSystemMemorySize64 instead. https://go.microsoft.com/fwlink/?linkid=14202")] public int NonpagedSystemMemorySize { get { throw null; } } @@ -116,8 +116,10 @@ public void Refresh() { } public static System.Diagnostics.Process Start(string fileName) { throw null; } public static System.Diagnostics.Process Start(string fileName, string arguments) { throw null; } [System.CLSCompliantAttribute(false)] + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.Diagnostics.Process Start(string fileName, string userName, System.Security.SecureString password, string domain) { throw null; } [System.CLSCompliantAttribute(false)] + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.Diagnostics.Process Start(string fileName, string arguments, string userName, System.Security.SecureString password, string domain) { throw null; } public override string ToString() { throw null; } public void WaitForExit() { } @@ -163,15 +165,19 @@ public ProcessStartInfo(string fileName, string arguments) { } public System.Collections.ObjectModel.Collection ArgumentList { get { throw null; } } public string Arguments { get { throw null; } set { } } public bool CreateNoWindow { get { throw null; } set { } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public string Domain { get { throw null; } set { } } public System.Collections.Generic.IDictionary Environment { get { throw null; } } public System.Collections.Specialized.StringDictionary EnvironmentVariables { get { throw null; } } public bool ErrorDialog { get { throw null; } set { } } public System.IntPtr ErrorDialogParentHandle { get { throw null; } set { } } public string FileName { get { throw null; } set { } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public bool LoadUserProfile { get { throw null; } set { } } [System.CLSCompliantAttribute(false)] + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public System.Security.SecureString? Password { get { throw null; } set { } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public string? PasswordInClearText { get { throw null; } set { } } public bool RedirectStandardError { get { throw null; } set { } } public bool RedirectStandardInput { get { throw null; } set { } } @@ -196,8 +202,9 @@ internal ProcessThread() { } public int Id { get { throw null; } } public int IdealProcessor { set { } } public bool PriorityBoostEnabled { get { throw null; } set { } } - public System.Diagnostics.ThreadPriorityLevel PriorityLevel { get { throw null; } set { } } + public System.Diagnostics.ThreadPriorityLevel PriorityLevel { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } public System.TimeSpan PrivilegedProcessorTime { get { throw null; } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public System.IntPtr ProcessorAffinity { set { } } public System.IntPtr StartAddress { get { throw null; } } public System.DateTime StartTime { get { throw null; } } diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs index 131912f5729f95..845c054930dd1c 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs @@ -9,6 +9,7 @@ using System.Security; using System.Text; using System.Threading; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -41,12 +42,14 @@ public static void LeaveDebugMode() } [CLSCompliant(false)] + [MinimumOSPlatform("windows7.0")] public static Process Start(string fileName, string userName, SecureString password, string domain) { throw new PlatformNotSupportedException(SR.ProcessStartWithPasswordAndDomainNotSupported); } [CLSCompliant(false)] + [MinimumOSPlatform("windows7.0")] public static Process Start(string fileName, string arguments, string userName, SecureString password, string domain) { throw new PlatformNotSupportedException(SR.ProcessStartWithPasswordAndDomainNotSupported); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs index 34e17620dca79e..f56571300ceac1 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs @@ -6,6 +6,7 @@ using System.ComponentModel; using System.IO; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using System.Security; using System.Text; using System.Threading; @@ -46,6 +47,7 @@ public static Process[] GetProcessesByName(string? processName, string machineNa } [CLSCompliant(false)] + [MinimumOSPlatform("windows7.0")] public static Process? Start(string fileName, string userName, SecureString password, string domain) { ProcessStartInfo startInfo = new ProcessStartInfo(fileName); @@ -57,6 +59,7 @@ public static Process[] GetProcessesByName(string? processName, string machineNa } [CLSCompliant(false)] + [MinimumOSPlatform("windows7.0")] public static Process? Start(string fileName, string arguments, string userName, SecureString password, string domain) { ProcessStartInfo startInfo = new ProcessStartInfo(fileName, arguments); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs index e47cac99ac8127..17b665eb5dd05e 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs @@ -10,6 +10,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -264,6 +265,7 @@ public IntPtr MaxWorkingSet EnsureWorkingSetLimits(); return _maxWorkingSet; } + [MinimumOSPlatform("windows7.0")] set { SetWorkingSetLimits(null, value); @@ -283,6 +285,7 @@ public IntPtr MinWorkingSet EnsureWorkingSetLimits(); return _minWorkingSet; } + [MinimumOSPlatform("windows7.0")] set { SetWorkingSetLimits(value, null); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs index 339e87248a8172..1af5bb923dc9cb 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs @@ -3,6 +3,7 @@ using System; using System.Security; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -13,18 +14,21 @@ public sealed partial class ProcessStartInfo { private const bool CaseSensitiveEnvironmentVariables = true; + [MinimumOSPlatform("windows7.0")] public string PasswordInClearText { get { throw new PlatformNotSupportedException(SR.Format(SR.ProcessStartSingleFeatureNotSupported, nameof(PasswordInClearText))); } set { throw new PlatformNotSupportedException(SR.Format(SR.ProcessStartSingleFeatureNotSupported, nameof(PasswordInClearText))); } } + [MinimumOSPlatform("windows7.0")] public string Domain { get { throw new PlatformNotSupportedException(SR.Format(SR.ProcessStartSingleFeatureNotSupported, nameof(Domain))); } set { throw new PlatformNotSupportedException(SR.Format(SR.ProcessStartSingleFeatureNotSupported, nameof(Domain))); } } + [MinimumOSPlatform("windows7.0")] public bool LoadUserProfile { get { throw new PlatformNotSupportedException(SR.Format(SR.ProcessStartSingleFeatureNotSupported, nameof(LoadUserProfile))); } @@ -36,6 +40,7 @@ public bool LoadUserProfile public string[] Verbs => Array.Empty(); [CLSCompliant(false)] + [MinimumOSPlatform("windows7.0")] public SecureString Password { get { throw new PlatformNotSupportedException(SR.Format(SR.ProcessStartSingleFeatureNotSupported, nameof(Password))); } diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Windows.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Windows.cs index 465cd0b5ed8717..5545b0590f4c74 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Windows.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Windows.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Security; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -11,17 +12,21 @@ public sealed partial class ProcessStartInfo private const bool CaseSensitiveEnvironmentVariables = false; + [MinimumOSPlatform("windows7.0")] public string? PasswordInClearText { get; set; } + [MinimumOSPlatform("windows7.0")] public string Domain { get => _domain ?? string.Empty; set => _domain = value; } + [MinimumOSPlatform("windows7.0")] public bool LoadUserProfile { get; set; } [CLSCompliant(false)] + [MinimumOSPlatform("windows7.0")] public SecureString? Password { get; set; } } } diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Unix.cs index cca6089914ed5c..ac65c2dffb871e 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Unix.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.Diagnostics { public partial class ProcessThread @@ -39,6 +41,7 @@ private bool PriorityBoostEnabledCore /// two, etc. For example, the value 1 means run on processor one, 2 means run on /// processor two, 3 means run on processor one or two. /// + [MinimumOSPlatform("windows7.0")] public IntPtr ProcessorAffinity { set { throw new PlatformNotSupportedException(); } // No ability to change the affinity of a thread in an arbitrary process diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs index 99fd7415725a52..450a1d77edf3d8 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs @@ -3,6 +3,7 @@ using Microsoft.Win32.SafeHandles; using System.ComponentModel; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -99,6 +100,7 @@ private ThreadPriorityLevel PriorityLevelCore /// two, etc. For example, the value 1 means run on processor one, 2 means run on /// processor two, 3 means run on processor one or two. /// + [MinimumOSPlatform("windows7.0")] public IntPtr ProcessorAffinity { set diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs index 4d68dd2233c32d..b4ad10f029c53e 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -94,6 +95,7 @@ public ThreadPriorityLevel PriorityLevel } return _priorityLevel.Value; } + [MinimumOSPlatform("windows7.0")] set { PriorityLevelCore = value; diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs index 3e860543950a53..6aca35f46032e1 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs @@ -33,7 +33,7 @@ private void TestWindowApisUnix() } [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] - public void MainWindowHandle_GetUnix_ThrowsPlatformNotSupportedException() + public void MainWindowHandle_GetUnix_ReturnsDefaultValue() { CreateDefaultProcess(); diff --git a/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props b/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props index 2a7de3529ba719..e6b3574d56878a 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props +++ b/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props @@ -6,5 +6,6 @@ to a different assembly. --> 4.0.0.0 ECMA + true \ No newline at end of file diff --git a/src/libraries/System.DirectoryServices/Directory.Build.props b/src/libraries/System.DirectoryServices/Directory.Build.props index 131fb6770cd1a1..d5f3585d0abb0b 100644 --- a/src/libraries/System.DirectoryServices/Directory.Build.props +++ b/src/libraries/System.DirectoryServices/Directory.Build.props @@ -6,5 +6,6 @@ to a different assembly. --> 4.0.0.0 Microsoft + true \ No newline at end of file diff --git a/src/libraries/System.IO.FileSystem.AccessControl/Directory.Build.props b/src/libraries/System.IO.FileSystem.AccessControl/Directory.Build.props index 8c72c62fd5932e..27a4a5522a2778 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/Directory.Build.props +++ b/src/libraries/System.IO.FileSystem.AccessControl/Directory.Build.props @@ -4,5 +4,6 @@ Microsoft true false + true \ No newline at end of file diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/Directory.Build.props b/src/libraries/System.IO.FileSystem.DriveInfo/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/Directory.Build.props +++ b/src/libraries/System.IO.FileSystem.DriveInfo/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.cs b/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.cs index fbd22e4ecb6bb4..cc5e3b7735695a 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.cs +++ b/src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.cs @@ -18,7 +18,7 @@ public DriveInfo(string driveName) { } public long TotalFreeSpace { get { throw null; } } public long TotalSize { get { throw null; } } [System.Diagnostics.CodeAnalysis.AllowNullAttribute] - public string VolumeLabel { get { throw null; } set { } } + public string VolumeLabel { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } public static System.IO.DriveInfo[] GetDrives() { throw null; } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public override string ToString() { throw null; } diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.UnixOrBrowser.cs b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.UnixOrBrowser.cs index ee2e5690e86b02..89ac3ae7ad5ff0 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.UnixOrBrowser.cs +++ b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.UnixOrBrowser.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Security; +using System.Runtime.Versioning; namespace System.IO { @@ -41,6 +42,7 @@ public string VolumeLabel { return Name; } + [MinimumOSPlatform("windows7.0")] set { throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs index 8d93728bf7dfb4..df7eadd5e1e5da 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs +++ b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs @@ -6,6 +6,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Text; +using System.Runtime.Versioning; namespace System.IO { @@ -138,6 +139,7 @@ public unsafe string VolumeLabel return new string(volumeName); } + [MinimumOSPlatform("windows7.0")] set { uint oldMode; diff --git a/src/libraries/System.IO.FileSystem/Directory.Build.props b/src/libraries/System.IO.FileSystem/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.IO.FileSystem/Directory.Build.props +++ b/src/libraries/System.IO.FileSystem/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs b/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs index 3b1cd74f5fbd8a..953c048a7943c3 100644 --- a/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs +++ b/src/libraries/System.IO.FileSystem/ref/System.IO.FileSystem.cs @@ -121,8 +121,10 @@ public static void Copy(string sourceFileName, string destFileName, bool overwri public static System.IO.FileStream Create(string path, int bufferSize) { throw null; } public static System.IO.FileStream Create(string path, int bufferSize, System.IO.FileOptions options) { throw null; } public static System.IO.StreamWriter CreateText(string path) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void Decrypt(string path) { } public static void Delete(string path) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void Encrypt(string path) { } public static bool Exists(string? path) { throw null; } public static System.IO.FileAttributes GetAttributes(string path) { throw null; } diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/File.cs b/src/libraries/System.IO.FileSystem/src/System/IO/File.cs index 1b6b2190357527..2e5909c15a03d3 100644 --- a/src/libraries/System.IO.FileSystem/src/System/IO/File.cs +++ b/src/libraries/System.IO.FileSystem/src/System/IO/File.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.IO; using System.Runtime.ExceptionServices; +using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -645,11 +646,13 @@ public static void Move(string sourceFileName, string destFileName, bool overwri FileSystem.MoveFile(fullSourceFileName, fullDestFileName, overwrite); } + [MinimumOSPlatform("windows7.0")] public static void Encrypt(string path) { FileSystem.Encrypt(path ?? throw new ArgumentNullException(nameof(path))); } + [MinimumOSPlatform("windows7.0")] public static void Decrypt(string path) { FileSystem.Decrypt(path ?? throw new ArgumentNullException(nameof(path))); diff --git a/src/libraries/System.IO.MemoryMappedFiles/Directory.Build.props b/src/libraries/System.IO.MemoryMappedFiles/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/Directory.Build.props +++ b/src/libraries/System.IO.MemoryMappedFiles/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs b/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs index 4808e3f0e1d12f..4748d3acb85b18 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs @@ -33,8 +33,11 @@ internal MemoryMappedFile() { } public static System.IO.MemoryMappedFiles.MemoryMappedFile CreateNew(string? mapName, long capacity) { throw null; } public static System.IO.MemoryMappedFiles.MemoryMappedFile CreateNew(string? mapName, long capacity, System.IO.MemoryMappedFiles.MemoryMappedFileAccess access) { throw null; } public static System.IO.MemoryMappedFiles.MemoryMappedFile CreateNew(string? mapName, long capacity, System.IO.MemoryMappedFiles.MemoryMappedFileAccess access, System.IO.MemoryMappedFiles.MemoryMappedFileOptions options, System.IO.HandleInheritability inheritability) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IO.MemoryMappedFiles.MemoryMappedFile CreateOrOpen(string mapName, long capacity) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IO.MemoryMappedFiles.MemoryMappedFile CreateOrOpen(string mapName, long capacity, System.IO.MemoryMappedFiles.MemoryMappedFileAccess access) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IO.MemoryMappedFiles.MemoryMappedFile CreateOrOpen(string mapName, long capacity, System.IO.MemoryMappedFiles.MemoryMappedFileAccess access, System.IO.MemoryMappedFiles.MemoryMappedFileOptions options, System.IO.HandleInheritability inheritability) { throw null; } public System.IO.MemoryMappedFiles.MemoryMappedViewAccessor CreateViewAccessor() { throw null; } public System.IO.MemoryMappedFiles.MemoryMappedViewAccessor CreateViewAccessor(long offset, long size) { throw null; } @@ -44,8 +47,11 @@ internal MemoryMappedFile() { } public System.IO.MemoryMappedFiles.MemoryMappedViewStream CreateViewStream(long offset, long size, System.IO.MemoryMappedFiles.MemoryMappedFileAccess access) { throw null; } public void Dispose() { } protected virtual void Dispose(bool disposing) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IO.MemoryMappedFiles.MemoryMappedFile OpenExisting(string mapName) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IO.MemoryMappedFiles.MemoryMappedFile OpenExisting(string mapName, System.IO.MemoryMappedFiles.MemoryMappedFileRights desiredAccessRights) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IO.MemoryMappedFiles.MemoryMappedFile OpenExisting(string mapName, System.IO.MemoryMappedFiles.MemoryMappedFileRights desiredAccessRights, System.IO.HandleInheritability inheritability) { throw null; } } public enum MemoryMappedFileAccess diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs index 3d26335acb3174..aed549229ae1db 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs @@ -3,6 +3,7 @@ using Microsoft.Win32.SafeHandles; using System.Diagnostics; +using System.Runtime.Versioning; namespace System.IO.MemoryMappedFiles { @@ -43,16 +44,19 @@ private MemoryMappedFile(SafeMemoryMappedFileHandle handle, FileStream fileStrea // the first override of this method. Note: having ReadWrite access to the object does not mean that we // have ReadWrite access to the pages mapping the file. The OS will check against the access on the pages // when a view is created. + [MinimumOSPlatform("windows7.0")] public static MemoryMappedFile OpenExisting(string mapName) { return OpenExisting(mapName, MemoryMappedFileRights.ReadWrite, HandleInheritability.None); } + [MinimumOSPlatform("windows7.0")] public static MemoryMappedFile OpenExisting(string mapName, MemoryMappedFileRights desiredAccessRights) { return OpenExisting(mapName, desiredAccessRights, HandleInheritability.None); } + [MinimumOSPlatform("windows7.0")] public static MemoryMappedFile OpenExisting(string mapName, MemoryMappedFileRights desiredAccessRights, HandleInheritability inheritability) { @@ -291,18 +295,21 @@ public static MemoryMappedFile CreateNew(string? mapName, long capacity, MemoryM // memory mapped file if one exists with the same name. The capacity, options, and // memoryMappedFileSecurity arguments will be ignored in the case of the later. // This is ideal for P2P style IPC. + [MinimumOSPlatform("windows7.0")] public static MemoryMappedFile CreateOrOpen(string mapName, long capacity) { return CreateOrOpen(mapName, capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None, HandleInheritability.None); } + [MinimumOSPlatform("windows7.0")] public static MemoryMappedFile CreateOrOpen(string mapName, long capacity, MemoryMappedFileAccess access) { return CreateOrOpen(mapName, capacity, access, MemoryMappedFileOptions.None, HandleInheritability.None); } + [MinimumOSPlatform("windows7.0")] public static MemoryMappedFile CreateOrOpen(string mapName, long capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, HandleInheritability inheritability) diff --git a/src/libraries/System.IO.Pipes.AccessControl/Directory.Build.props b/src/libraries/System.IO.Pipes.AccessControl/Directory.Build.props index 8c72c62fd5932e..27a4a5522a2778 100644 --- a/src/libraries/System.IO.Pipes.AccessControl/Directory.Build.props +++ b/src/libraries/System.IO.Pipes.AccessControl/Directory.Build.props @@ -4,5 +4,6 @@ Microsoft true false + true \ No newline at end of file diff --git a/src/libraries/System.IO.Pipes/Directory.Build.props b/src/libraries/System.IO.Pipes/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.IO.Pipes/Directory.Build.props +++ b/src/libraries/System.IO.Pipes/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs b/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs index 52a6ea136f912d..8ef9f9f5b06477 100644 --- a/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs +++ b/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs @@ -48,6 +48,7 @@ public sealed partial class NamedPipeClientStream : System.IO.Pipes.PipeStream public NamedPipeClientStream(string serverName, string pipeName, System.IO.Pipes.PipeDirection direction, System.IO.Pipes.PipeOptions options) : base (default(System.IO.Pipes.PipeDirection), default(int)) { } public NamedPipeClientStream(string serverName, string pipeName, System.IO.Pipes.PipeDirection direction, System.IO.Pipes.PipeOptions options, System.Security.Principal.TokenImpersonationLevel impersonationLevel) : base (default(System.IO.Pipes.PipeDirection), default(int)) { } public NamedPipeClientStream(string serverName, string pipeName, System.IO.Pipes.PipeDirection direction, System.IO.Pipes.PipeOptions options, System.Security.Principal.TokenImpersonationLevel impersonationLevel, System.IO.HandleInheritability inheritability) : base (default(System.IO.Pipes.PipeDirection), default(int)) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public int NumberOfServerInstances { get { throw null; } } protected internal override void CheckPipePropertyOperations() { } public void Connect() { } @@ -128,6 +129,7 @@ protected void InitializeHandle(Microsoft.Win32.SafeHandles.SafePipeHandle? hand public override int ReadByte() { throw null; } public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; } public override void SetLength(long value) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public void WaitForPipeDrain() { } public override void Write(byte[] buffer, int offset, int count) { } public override void Write(System.ReadOnlySpan buffer) { } @@ -139,6 +141,7 @@ public override void WriteByte(byte value) { } public enum PipeTransmissionMode { Byte = 0, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] Message = 1, } } diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Unix.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Unix.cs index f8f55aa72ff0e1..dfb09b40cfed2c 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Unix.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Unix.cs @@ -8,6 +8,7 @@ using System.Net.Sockets; using System.Security; using System.Threading; +using System.Runtime.Versioning; namespace System.IO.Pipes { @@ -66,6 +67,7 @@ private bool TryConnect(int timeout, CancellationToken cancellationToken) return true; } + [MinimumOSPlatform("windows7.0")] public int NumberOfServerInstances { get diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs index bf2c8cfde7430c..730f1eab530eea 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs @@ -6,6 +6,7 @@ using System.Security.Principal; using System.Threading; using Microsoft.Win32.SafeHandles; +using System.Runtime.Versioning; namespace System.IO.Pipes { @@ -107,6 +108,7 @@ private bool TryConnect(int timeout, CancellationToken cancellationToken) return true; } + [MinimumOSPlatform("windows7.0")] public unsafe int NumberOfServerInstances { get diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs index ce57953402abb5..502829f49daab6 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs @@ -10,6 +10,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using System.Runtime.Versioning; namespace System.IO.Pipes { @@ -219,6 +220,7 @@ private IOException GetIOExceptionForSocketException(SocketException e) } // Blocks until the other end of the pipe has read in all written buffer. + [MinimumOSPlatform("windows7.0")] public void WaitForPipeDrain() { CheckWriteOperations(); diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs index a06c0cd65a9cbf..030f769a762bd7 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Win32.SafeHandles; +using System.Runtime.Versioning; namespace System.IO.Pipes { @@ -178,6 +179,7 @@ private Task WriteAsyncCore(ReadOnlyMemory buffer, CancellationToken cance } // Blocks until the other end of the pipe has read in all written buffer. + [MinimumOSPlatform("windows7.0")] public void WaitForPipeDrain() { CheckWriteOperations(); diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeTransmissionMode.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeTransmissionMode.cs index f7ba7a39e9642f..fbfd0ccf85ec05 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeTransmissionMode.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeTransmissionMode.cs @@ -1,11 +1,14 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.IO.Pipes { public enum PipeTransmissionMode { Byte = 0, + [MinimumOSPlatform("windows7.0")] Message = 1, } } diff --git a/src/libraries/System.Management/Directory.Build.props b/src/libraries/System.Management/Directory.Build.props index 131fb6770cd1a1..d5f3585d0abb0b 100644 --- a/src/libraries/System.Management/Directory.Build.props +++ b/src/libraries/System.Management/Directory.Build.props @@ -6,5 +6,6 @@ to a different assembly. --> 4.0.0.0 Microsoft + true \ No newline at end of file diff --git a/src/libraries/System.Net.Http.WinHttpHandler/Directory.Build.props b/src/libraries/System.Net.Http.WinHttpHandler/Directory.Build.props index 63f02a0f817ef2..33e65b7cb46516 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/Directory.Build.props +++ b/src/libraries/System.Net.Http.WinHttpHandler/Directory.Build.props @@ -2,5 +2,6 @@ Microsoft + true \ No newline at end of file diff --git a/src/libraries/System.Net.HttpListener/Directory.Build.props b/src/libraries/System.Net.HttpListener/Directory.Build.props index 2b9e2844e4ee3f..e912bb862bfa60 100644 --- a/src/libraries/System.Net.HttpListener/Directory.Build.props +++ b/src/libraries/System.Net.HttpListener/Directory.Build.props @@ -3,5 +3,6 @@ Open true + true \ No newline at end of file diff --git a/src/libraries/System.Net.HttpListener/ref/System.Net.HttpListener.cs b/src/libraries/System.Net.HttpListener/ref/System.Net.HttpListener.cs index afb9e0d70e9d5d..3e867fd5a07b3b 100644 --- a/src/libraries/System.Net.HttpListener/ref/System.Net.HttpListener.cs +++ b/src/libraries/System.Net.HttpListener/ref/System.Net.HttpListener.cs @@ -139,11 +139,11 @@ public partial class HttpListenerTimeoutManager { internal HttpListenerTimeoutManager() { } public System.TimeSpan DrainEntityBody { get { throw null; } set { } } - public System.TimeSpan EntityBody { get { throw null; } set { } } - public System.TimeSpan HeaderWait { get { throw null; } set { } } + public System.TimeSpan EntityBody { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + public System.TimeSpan HeaderWait { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } public System.TimeSpan IdleConnection { get { throw null; } set { } } - public long MinSendBytesPerSecond { get { throw null; } set { } } - public System.TimeSpan RequestQueue { get { throw null; } set { } } + public long MinSendBytesPerSecond { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } + public System.TimeSpan RequestQueue { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } } } namespace System.Net.WebSockets diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerTimeoutManager.Managed.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerTimeoutManager.Managed.cs index b082aaa7e83c08..fbb9d1718db8dc 100644 --- a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerTimeoutManager.Managed.cs +++ b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerTimeoutManager.Managed.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.Net { public class HttpListenerTimeoutManager @@ -37,6 +39,7 @@ public TimeSpan IdleConnection public TimeSpan EntityBody { get => TimeSpan.Zero; + [MinimumOSPlatform("windows7.0")] set { ValidateTimeout(value); @@ -47,6 +50,7 @@ public TimeSpan EntityBody public TimeSpan HeaderWait { get => TimeSpan.Zero; + [MinimumOSPlatform("windows7.0")] set { ValidateTimeout(value); @@ -57,6 +61,7 @@ public TimeSpan HeaderWait public long MinSendBytesPerSecond { get => 0; + [MinimumOSPlatform("windows7.0")] set { if (value < 0 || value > uint.MaxValue) @@ -70,6 +75,7 @@ public long MinSendBytesPerSecond public TimeSpan RequestQueue { get => TimeSpan.Zero; + [MinimumOSPlatform("windows7.0")] set { ValidateTimeout(value); diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerTimeoutManager.Windows.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerTimeoutManager.Windows.cs index d967a73df66518..3de078196d9e9a 100644 --- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerTimeoutManager.Windows.cs +++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerTimeoutManager.Windows.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; +using System.Runtime.Versioning; namespace System.Net { @@ -82,6 +83,7 @@ public TimeSpan EntityBody { return GetTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE.EntityBody); } + [MinimumOSPlatform("windows7.0")] set { SetTimespanTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE.EntityBody, value); @@ -119,6 +121,7 @@ public TimeSpan RequestQueue { return GetTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE.RequestQueue); } + [MinimumOSPlatform("windows7.0")] set { SetTimespanTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE.RequestQueue, value); @@ -154,6 +157,7 @@ public TimeSpan HeaderWait { return GetTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE.HeaderWait); } + [MinimumOSPlatform("windows7.0")] set { SetTimespanTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE.HeaderWait, value); @@ -173,6 +177,7 @@ public long MinSendBytesPerSecond // return _minSendBytesPerSecond; } + [MinimumOSPlatform("windows7.0")] set { // diff --git a/src/libraries/System.Net.Sockets/Directory.Build.props b/src/libraries/System.Net.Sockets/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.Net.Sockets/Directory.Build.props +++ b/src/libraries/System.Net.Sockets/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs b/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs index 0a983f426ee39e..0917f00c68e002 100644 --- a/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs +++ b/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs @@ -8,39 +8,70 @@ namespace System.Net.Sockets { public enum IOControlCode : long { + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] EnableCircularQueuing = (long)671088642, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] Flush = (long)671088644, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] AddressListChange = (long)671088663, DataToRead = (long)1074030207, OobDataRead = (long)1074033415, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] GetBroadcastAddress = (long)1207959557, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] AddressListQuery = (long)1207959574, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] QueryTargetPnpHandle = (long)1207959576, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] AsyncIO = (long)2147772029, NonBlockingIO = (long)2147772030, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] AssociateHandle = (long)2281701377, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] MultipointLoopback = (long)2281701385, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] MulticastScope = (long)2281701386, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] SetQos = (long)2281701387, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] SetGroupQos = (long)2281701388, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] RoutingInterfaceChange = (long)2281701397, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] NamespaceChange = (long)2281701401, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] ReceiveAll = (long)2550136833, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] ReceiveAllMulticast = (long)2550136834, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] ReceiveAllIgmpMulticast = (long)2550136835, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] KeepAliveValues = (long)2550136836, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] AbsorbRouterAlert = (long)2550136837, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] UnicastInterface = (long)2550136838, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] LimitBroadcasts = (long)2550136839, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] BindToInterface = (long)2550136840, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] MulticastInterface = (long)2550136841, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] AddMulticastGroupOnInterface = (long)2550136842, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] DeleteMulticastGroupFromInterface = (long)2550136843, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] GetExtensionFunctionPointer = (long)3355443206, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] GetQos = (long)3355443207, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] GetGroupQos = (long)3355443208, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] TranslateHandle = (long)3355443213, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] RoutingInterfaceQuery = (long)3355443220, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] AddressListSort = (long)3355443225, } public partial struct IPPacketInformation @@ -294,6 +325,7 @@ public void Disconnect(bool reuseSocket) { } public bool DisconnectAsync(System.Net.Sockets.SocketAsyncEventArgs e) { throw null; } public void Dispose() { } protected virtual void Dispose(bool disposing) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public System.Net.Sockets.SocketInformation DuplicateAndClose(int targetProcessId) { throw null; } public System.Net.Sockets.Socket EndAccept(out byte[]? buffer, System.IAsyncResult asyncResult) { throw null; } public System.Net.Sockets.Socket EndAccept(out byte[]? buffer, out int bytesTransferred, System.IAsyncResult asyncResult) { throw null; } @@ -358,6 +390,7 @@ public void SendFile(string? fileName, byte[]? preBuffer, byte[]? postBuffer, Sy public int SendTo(byte[] buffer, System.Net.EndPoint remoteEP) { throw null; } public int SendTo(byte[] buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEP) { throw null; } public bool SendToAsync(System.Net.Sockets.SocketAsyncEventArgs e) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public void SetIPProtectionLevel(System.Net.Sockets.IPProtectionLevel level) { } public void SetRawSocketOption(int optionLevel, int optionName, System.ReadOnlySpan optionValue) { } public void SetSocketOption(System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, bool optionValue) { } @@ -592,6 +625,7 @@ public TcpListener(System.Net.IPEndPoint localEP) { } public System.Threading.Tasks.Task AcceptSocketAsync() { throw null; } public System.Net.Sockets.TcpClient AcceptTcpClient() { throw null; } public System.Threading.Tasks.Task AcceptTcpClientAsync() { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public void AllowNatTraversal(bool allowed) { } public System.IAsyncResult BeginAcceptSocket(System.AsyncCallback? callback, object? state) { throw null; } public System.IAsyncResult BeginAcceptTcpClient(System.AsyncCallback? callback, object? state) { throw null; } @@ -609,8 +643,11 @@ public enum TransmitFileOptions UseDefaultWorkerThread = 0, Disconnect = 1, ReuseSocket = 2, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] WriteBehind = 4, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] UseSystemThread = 16, + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] UseKernelApc = 32, } public partial class UdpClient : System.IDisposable @@ -629,6 +666,7 @@ public UdpClient(string hostname, int port) { } public bool ExclusiveAddressUse { get { throw null; } set { } } public bool MulticastLoopback { get { throw null; } set { } } public short Ttl { get { throw null; } set { } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public void AllowNatTraversal(bool allowed) { } public System.IAsyncResult BeginReceive(System.AsyncCallback? requestCallback, object? state) { throw null; } public System.IAsyncResult BeginSend(byte[] datagram, int bytes, System.AsyncCallback? requestCallback, object? state) { throw null; } diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IOControlCode.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IOControlCode.cs index 7ba90cc6fd9ec5..fc1d69159bab31 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IOControlCode.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/IOControlCode.cs @@ -1,43 +1,76 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.Net.Sockets { public enum IOControlCode : long { + [MinimumOSPlatform("windows7.0")] AsyncIO = 0x8004667D, NonBlockingIO = 0x8004667E, // fionbio DataToRead = 0x4004667F, // fionread OobDataRead = 0x40047307, + [MinimumOSPlatform("windows7.0")] AssociateHandle = 0x88000001, // SIO_ASSOCIATE_HANDLE + [MinimumOSPlatform("windows7.0")] EnableCircularQueuing = 0x28000002, + [MinimumOSPlatform("windows7.0")] Flush = 0x28000004, + [MinimumOSPlatform("windows7.0")] GetBroadcastAddress = 0x48000005, + [MinimumOSPlatform("windows7.0")] GetExtensionFunctionPointer = 0xC8000006, + [MinimumOSPlatform("windows7.0")] GetQos = 0xC8000007, + [MinimumOSPlatform("windows7.0")] GetGroupQos = 0xC8000008, + [MinimumOSPlatform("windows7.0")] MultipointLoopback = 0x88000009, + [MinimumOSPlatform("windows7.0")] MulticastScope = 0x8800000A, + [MinimumOSPlatform("windows7.0")] SetQos = 0x8800000B, + [MinimumOSPlatform("windows7.0")] SetGroupQos = 0x8800000C, + [MinimumOSPlatform("windows7.0")] TranslateHandle = 0xC800000D, + [MinimumOSPlatform("windows7.0")] RoutingInterfaceQuery = 0xC8000014, + [MinimumOSPlatform("windows7.0")] RoutingInterfaceChange = 0x88000015, + [MinimumOSPlatform("windows7.0")] AddressListQuery = 0x48000016, + [MinimumOSPlatform("windows7.0")] AddressListChange = 0x28000017, + [MinimumOSPlatform("windows7.0")] QueryTargetPnpHandle = 0x48000018, + [MinimumOSPlatform("windows7.0")] NamespaceChange = 0x88000019, + [MinimumOSPlatform("windows7.0")] AddressListSort = 0xC8000019, + [MinimumOSPlatform("windows7.0")] ReceiveAll = 0x98000001, + [MinimumOSPlatform("windows7.0")] ReceiveAllMulticast = 0x98000002, + [MinimumOSPlatform("windows7.0")] ReceiveAllIgmpMulticast = 0x98000003, + [MinimumOSPlatform("windows7.0")] KeepAliveValues = 0x98000004, + [MinimumOSPlatform("windows7.0")] AbsorbRouterAlert = 0x98000005, + [MinimumOSPlatform("windows7.0")] UnicastInterface = 0x98000006, + [MinimumOSPlatform("windows7.0")] LimitBroadcasts = 0x98000007, + [MinimumOSPlatform("windows7.0")] BindToInterface = 0x98000008, + [MinimumOSPlatform("windows7.0")] MulticastInterface = 0x98000009, + [MinimumOSPlatform("windows7.0")] AddMulticastGroupOnInterface = 0x9800000A, + [MinimumOSPlatform("windows7.0")] DeleteMulticastGroupFromInterface = 0x9800000B } } diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Unix.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Unix.cs index b84761722674ae..0886dbff4ccc35 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Unix.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Unix.cs @@ -1,15 +1,16 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.Win32.SafeHandles; using System.Diagnostics; using System.IO; using System.Threading.Tasks; +using System.Runtime.Versioning; namespace System.Net.Sockets { public partial class Socket { + [MinimumOSPlatform("windows7.0")] public Socket(SocketInformation socketInformation) { // This constructor works in conjunction with DuplicateAndClose, which is not supported on Unix. @@ -17,6 +18,7 @@ public Socket(SocketInformation socketInformation) throw new PlatformNotSupportedException(SR.net_sockets_duplicateandclose_notsupported); } + [MinimumOSPlatform("windows7.0")] public SocketInformation DuplicateAndClose(int targetProcessId) { // DuplicateAndClose is not supported on Unix, since passing file descriptors between processes diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs index d20fbea8a1b21d..d9c64a5471278d 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs @@ -6,8 +6,8 @@ using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Threading; +using System.Runtime.Versioning; namespace System.Net.Sockets { @@ -17,6 +17,7 @@ public partial class Socket internal void ReplaceHandleIfNecessaryAfterFailedConnect() { /* nop on Windows */ } + [MinimumOSPlatform("windows7.0")] public Socket(SocketInformation socketInformation) { InitializeSockets(); @@ -105,6 +106,7 @@ private unsafe void LoadSocketTypeFromHandle( blocking = true; } + [MinimumOSPlatform("windows7.0")] public SocketInformation DuplicateAndClose(int targetProcessId) { ThrowIfDisposed(); diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs index e75f084e1c9a61..a874c7f60dc427 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs @@ -13,6 +13,7 @@ using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Threading; +using System.Runtime.Versioning; namespace System.Net.Sockets { @@ -1935,6 +1936,7 @@ public int GetRawSocketOption(int optionLevel, int optionName, Span option return realOptionLength; } + [MinimumOSPlatform("windows7.0")] public void SetIPProtectionLevel(IPProtectionLevel level) { if (level == IPProtectionLevel.Unspecified) diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TCPListener.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TCPListener.cs index d11d283ef8af1b..df906c11b4d022 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TCPListener.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TCPListener.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Threading.Tasks; +using System.Runtime.Versioning; namespace System.Net.Sockets { @@ -111,6 +112,7 @@ public bool ExclusiveAddressUse } } + [MinimumOSPlatform("windows7.0")] public void AllowNatTraversal(bool allowed) { if (_active) diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TransmitFileOptions.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TransmitFileOptions.cs index 9d7e2451df1b13..cc1d42c633f00e 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TransmitFileOptions.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/TransmitFileOptions.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.Net.Sockets { [Flags] @@ -9,8 +11,11 @@ public enum TransmitFileOptions UseDefaultWorkerThread = 0x00, Disconnect = 0x01, ReuseSocket = 0x02, + [MinimumOSPlatform("windows7.0")] WriteBehind = 0x04, + [MinimumOSPlatform("windows7.0")] UseSystemThread = 0x10, + [MinimumOSPlatform("windows7.0")] UseKernelApc = 0x20, }; } diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/UDPClient.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/UDPClient.cs index 83243cfc3bdec1..e5b9074bb4cf66 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/UDPClient.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/UDPClient.cs @@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; +using System.Runtime.Versioning; namespace System.Net.Sockets { @@ -192,6 +193,7 @@ public bool ExclusiveAddressUse } } + [MinimumOSPlatform("windows7.0")] public void AllowNatTraversal(bool allowed) { _clientSocket.SetIPProtectionLevel(allowed ? IPProtectionLevel.Unrestricted : IPProtectionLevel.EdgeRestricted); diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 99a2fb92f33418..3037ae44d799d7 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -825,15 +825,11 @@ - - - + - - diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs index c1e4e132ccba1a..ff64dbf87889bd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs @@ -5,46 +5,46 @@ namespace System.Diagnostics.CodeAnalysis { /// Specifies that null is allowed as an input even if the corresponding type disallows it. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class AllowNullAttribute : Attribute { } /// Specifies that null is disallowed as an input even if the corresponding type allows it. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class DisallowNullAttribute : Attribute { } /// Specifies that an output may be null even if the corresponding type disallows it. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class MaybeNullAttribute : Attribute { } /// Specifies that an output will not be null even if the corresponding type allows it. Specifies that an input argument was not null when the call returns. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class NotNullAttribute : Attribute { } /// Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class MaybeNullWhenAttribute : Attribute { @@ -60,10 +60,10 @@ sealed class MaybeNullWhenAttribute : Attribute /// Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class NotNullWhenAttribute : Attribute { @@ -79,10 +79,10 @@ sealed class NotNullWhenAttribute : Attribute /// Specifies that the output will be non-null if the named parameter is non-null. [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class NotNullIfNotNullAttribute : Attribute { @@ -98,19 +98,19 @@ sealed class NotNullIfNotNullAttribute : Attribute /// Applied to a method that will never return under any circumstance. [AttributeUsage(AttributeTargets.Method, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class DoesNotReturnAttribute : Attribute { } /// Specifies that the method will not return if the associated Boolean parameter is passed the specified value. [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class DoesNotReturnIfAttribute : Attribute { @@ -127,10 +127,10 @@ sealed class DoesNotReturnIfAttribute : Attribute /// Specifies that the method or property will ensure that the listed field and property members have not-null values. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class MemberNotNullAttribute : Attribute { @@ -152,10 +152,10 @@ sealed class MemberNotNullAttribute : Attribute /// Specifies that the method or property will ensure that the listed field and property members have not-null values when returning with the specified return value condition. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else +#if SYSTEM_PRIVATE_CORELIB public +#else + internal #endif sealed class MemberNotNullWhenAttribute : Attribute { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs index b18dc25838efc2..5be89fc0062308 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.Runtime.InteropServices { // Wrapper that is converted to a variant with VT_DISPATCH @@ -20,6 +22,7 @@ public DispatchWrapper(object? obj) } } + [MinimumOSPlatform("windows7.0")] public object? WrappedObject { get; } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs index aa94a55153f334..2e7c3b36b4e6a9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.InteropServices.ComTypes; +using System.Runtime.Versioning; namespace System.Runtime.InteropServices { @@ -14,6 +15,7 @@ public static int GetHRForException(Exception? e) return e?.HResult ?? 0; } + [MinimumOSPlatform("windows7.0")] public static int AddRef(IntPtr pUnk) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); @@ -21,11 +23,13 @@ public static int AddRef(IntPtr pUnk) public static bool AreComObjectsAvailableForCleanup() => false; + [MinimumOSPlatform("windows7.0")] public static IntPtr CreateAggregatedObject(IntPtr pOuter, object o) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object BindToMoniker(string monikerName) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); @@ -35,46 +39,55 @@ public static void CleanupUnusedObjectsInCurrentContext() { } + [MinimumOSPlatform("windows7.0")] public static IntPtr CreateAggregatedObject(IntPtr pOuter, T o) where T : notnull { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object? CreateWrapperOfType(object? o, Type t) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static TWrapper CreateWrapperOfType([AllowNull] T o) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static int FinalReleaseComObject(object o) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static IntPtr GetComInterfaceForObject(object o, Type T) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static IntPtr GetComInterfaceForObject(object o, Type T, CustomQueryInterfaceMode mode) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static IntPtr GetComInterfaceForObject([DisallowNull] T o) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object? GetComObjectData(object obj, object key) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); @@ -90,77 +103,92 @@ public static IntPtr GetHINSTANCE(Module m) return (IntPtr)(-1); } + [MinimumOSPlatform("windows7.0")] public static IntPtr GetIDispatchForObject(object o) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static IntPtr GetIUnknownForObject(object o) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static void GetNativeVariantForObject(object? obj, IntPtr pDstNativeVariant) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static void GetNativeVariantForObject([AllowNull] T obj, IntPtr pDstNativeVariant) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object GetTypedObjectForIUnknown(IntPtr pUnk, Type t) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object GetObjectForIUnknown(IntPtr pUnk) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object? GetObjectForNativeVariant(IntPtr pSrcNativeVariant) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] [return: MaybeNull] public static T GetObjectForNativeVariant(IntPtr pSrcNativeVariant) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object?[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int cVars) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static T[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int cVars) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static int GetStartComSlot(Type t) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static int GetEndComSlot(Type t) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static Type? GetTypeFromCLSID(Guid clsid) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static string GetTypeInfoName(ITypeInfo typeInfo) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static object GetUniqueObjectForIUnknown(IntPtr unknown) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); @@ -185,21 +213,25 @@ public static bool IsTypeVisibleFromCom(Type t) return false; } + [MinimumOSPlatform("windows7.0")] public static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static int Release(IntPtr pUnk) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static int ReleaseComObject(object o) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + [MinimumOSPlatform("windows7.0")] public static bool SetComObjectData(object obj, object key, object? data) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/MinimumOSPlatformAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/MinimumOSPlatformAttribute.cs deleted file mode 100644 index 08b2899ae1f5c4..00000000000000 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/MinimumOSPlatformAttribute.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.Runtime.Versioning -{ - /// - /// Records the operating system (and minimum version) that supports an API. Multiple attributes can be - /// applied to indicate support on multiple operating systems. - /// - /// - /// Callers can apply a - /// or use guards to prevent calls to APIs on unsupported operating systems. - /// - /// A given platform should only be specified once. - /// - [AttributeUsage(AttributeTargets.Assembly | - AttributeTargets.Class | - AttributeTargets.Constructor | - AttributeTargets.Event | - AttributeTargets.Field | - AttributeTargets.Method | - AttributeTargets.Module | - AttributeTargets.Property | - AttributeTargets.Struct, - AllowMultiple = true, Inherited = false)] - public sealed class MinimumOSPlatformAttribute : OSPlatformAttribute - { - public MinimumOSPlatformAttribute(string platformName) : base(platformName) - { - } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/OSPlatformAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/OSPlatformAttribute.cs deleted file mode 100644 index c2cbda55c5e588..00000000000000 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/OSPlatformAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.Runtime.Versioning -{ - /// - /// Base type for all platform-specific API attributes. - /// -#pragma warning disable CS3015 // Type has no accessible constructors which use only CLS-compliant types - public abstract class OSPlatformAttribute : Attribute -#pragma warning restore CS3015 - { - private protected OSPlatformAttribute(string platformName) - { - PlatformName = platformName; - } - public string PlatformName { get; } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/ObsoletedInOSPlatformAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/ObsoletedInOSPlatformAttribute.cs deleted file mode 100644 index 24628a1e1305bb..00000000000000 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/ObsoletedInOSPlatformAttribute.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.Runtime.Versioning -{ - /// - /// Marks APIs that were obsoleted in a given operating system version. - /// - /// Primarily used by OS bindings to indicate APIs that should only be used in - /// earlier versions. - /// - [AttributeUsage(AttributeTargets.Assembly | - AttributeTargets.Class | - AttributeTargets.Constructor | - AttributeTargets.Event | - AttributeTargets.Field | - AttributeTargets.Method | - AttributeTargets.Module | - AttributeTargets.Property | - AttributeTargets.Struct, - AllowMultiple = true, Inherited = false)] - public sealed class ObsoletedInOSPlatformAttribute : OSPlatformAttribute - { - public ObsoletedInOSPlatformAttribute(string platformName) : base(platformName) - { - } - - public ObsoletedInOSPlatformAttribute(string platformName, string message) : base(platformName) - { - Message = message; - } - - public string? Message { get; } - public string? Url { get; set; } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs new file mode 100644 index 00000000000000..c230113c9b0f2f --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs @@ -0,0 +1,142 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable enable +namespace System.Runtime.Versioning +{ + /// + /// Base type for all platform-specific API attributes. + /// +#pragma warning disable CS3015 // Type has no accessible constructors which use only CLS-compliant types +#if SYSTEM_PRIVATE_CORELIB + public +#else + internal +#endif + abstract class OSPlatformAttribute : Attribute +#pragma warning restore CS3015 + { + private protected OSPlatformAttribute(string platformName) + { + PlatformName = platformName; + } + public string PlatformName { get; } + } + + /// + /// Records the platform that the project targeted. + /// + [AttributeUsage(AttributeTargets.Assembly, + AllowMultiple = false, Inherited = false)] +#if SYSTEM_PRIVATE_CORELIB + public +#else + internal +#endif + sealed class TargetPlatformAttribute : OSPlatformAttribute + { + public TargetPlatformAttribute(string platformName) : base(platformName) + { + } + } + + /// + /// Records the operating system (and minimum version) that supports an API. Multiple attributes can be + /// applied to indicate support on multiple operating systems. + /// + /// + /// Callers can apply a + /// or use guards to prevent calls to APIs on unsupported operating systems. + /// + /// A given platform should only be specified once. + /// + [AttributeUsage(AttributeTargets.Assembly | + AttributeTargets.Class | + AttributeTargets.Constructor | + AttributeTargets.Enum | + AttributeTargets.Event | + AttributeTargets.Field | + AttributeTargets.Method | + AttributeTargets.Module | + AttributeTargets.Property | + AttributeTargets.Struct, + AllowMultiple = true, Inherited = false)] +#if SYSTEM_PRIVATE_CORELIB + public +#else + internal +#endif + sealed class MinimumOSPlatformAttribute : OSPlatformAttribute + { + public MinimumOSPlatformAttribute(string platformName) : base(platformName) + { + } + } + + /// + /// Marks APIs that were obsoleted in a given operating system version. + /// + /// Primarily used by OS bindings to indicate APIs that should only be used in + /// earlier versions. + /// + [AttributeUsage(AttributeTargets.Assembly | + AttributeTargets.Class | + AttributeTargets.Constructor | + AttributeTargets.Enum | + AttributeTargets.Event | + AttributeTargets.Field | + AttributeTargets.Method | + AttributeTargets.Module | + AttributeTargets.Property | + AttributeTargets.Struct, + AllowMultiple = true, Inherited = false)] +#if SYSTEM_PRIVATE_CORELIB + public +#else + internal +#endif + sealed class ObsoletedInOSPlatformAttribute : OSPlatformAttribute + { + public ObsoletedInOSPlatformAttribute(string platformName) : base(platformName) + { + } + + public ObsoletedInOSPlatformAttribute(string platformName, string message) : base(platformName) + { + Message = message; + } + + public string? Message { get; } + public string? Url { get; set; } + } + + /// + /// Marks APIs that were removed in a given operating system version. + /// + /// + /// Primarily used by OS bindings to indicate APIs that are only available in + /// earlier versions. + /// + [AttributeUsage(AttributeTargets.Assembly | + AttributeTargets.Class | + AttributeTargets.Constructor | + AttributeTargets.Enum | + AttributeTargets.Event | + AttributeTargets.Field | + AttributeTargets.Method | + AttributeTargets.Module | + AttributeTargets.Property | + AttributeTargets.Struct, + AllowMultiple = true, Inherited = false)] +#if SYSTEM_PRIVATE_CORELIB + public +#else + internal +#endif + sealed class RemovedInOSPlatformAttribute : OSPlatformAttribute + { + public RemovedInOSPlatformAttribute(string platformName) : base(platformName) + { + } + } +} \ No newline at end of file diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/RemovedInOSPlatformAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/RemovedInOSPlatformAttribute.cs deleted file mode 100644 index 688fae0f6d04c6..00000000000000 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/RemovedInOSPlatformAttribute.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.Runtime.Versioning -{ - /// - /// Marks APIs that were removed in a given operating system version. - /// - /// - /// Primarily used by OS bindings to indicate APIs that are only available in - /// earlier versions. - /// - [AttributeUsage(AttributeTargets.Assembly | - AttributeTargets.Class | - AttributeTargets.Constructor | - AttributeTargets.Event | - AttributeTargets.Field | - AttributeTargets.Method | - AttributeTargets.Module | - AttributeTargets.Property | - AttributeTargets.Struct, - AllowMultiple = true, Inherited = false)] - public sealed class RemovedInOSPlatformAttribute : OSPlatformAttribute - { - public RemovedInOSPlatformAttribute(string platformName) : base(platformName) - { - } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/TargetPlatformAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/TargetPlatformAttribute.cs deleted file mode 100644 index f3275306bacedc..00000000000000 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/TargetPlatformAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.Runtime.Versioning -{ - /// - /// Records the platform that the project targeted. - /// - [AttributeUsage(AttributeTargets.Assembly, - AllowMultiple = false, Inherited = false)] - public sealed class TargetPlatformAttribute : OSPlatformAttribute - { - public TargetPlatformAttribute(string platformName) : base(platformName) - { - } - } -} diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.cs index dd27d9303dbfb8..6d95be79f6ce3a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; +using System.Runtime.Versioning; namespace System.Threading { @@ -27,6 +28,7 @@ public EventWaitHandle(bool initialState, EventResetMode mode, string? name, out CreateEventCore(initialState, mode, name, out createdNew); } + [MinimumOSPlatform("windows7.0")] public static EventWaitHandle OpenExisting(string name) { switch (OpenExistingWorker(name, out EventWaitHandle? result)) @@ -43,6 +45,7 @@ public static EventWaitHandle OpenExisting(string name) } } + [MinimumOSPlatform("windows7.0")] public static bool TryOpenExisting(string name, [NotNullWhen(true)] out EventWaitHandle? result) => OpenExistingWorker(name, out result!) == OpenExistingResult.Success; } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.cs index 80f4c4b7577f40..40555cc8dfda65 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; +using System.Runtime.Versioning; namespace System.Threading { @@ -32,6 +33,7 @@ public Semaphore(int initialCount, int maximumCount, string? name, out bool crea CreateSemaphoreCore(initialCount, maximumCount, name, out createdNew); } + [MinimumOSPlatform("windows7.0")] public static Semaphore OpenExisting(string name) { switch (OpenExistingWorker(name, out Semaphore? result)) @@ -48,6 +50,7 @@ public static Semaphore OpenExisting(string name) } } + [MinimumOSPlatform("windows7.0")] public static bool TryOpenExisting(string name, [NotNullWhen(true)] out Semaphore? result) => OpenExistingWorker(name, out result!) == OpenExistingResult.Success; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs index e6039335527638..edc05663a04499 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs @@ -7,6 +7,7 @@ using System.Globalization; using System.Runtime.ConstrainedExecution; using System.Security.Principal; +using System.Runtime.Versioning; namespace System.Threading { @@ -224,6 +225,7 @@ public ApartmentState ApartmentState set => TrySetApartmentState(value); } + [MinimumOSPlatform("windows7.0")] public void SetApartmentState(ApartmentState state) { if (!TrySetApartmentState(state)) diff --git a/src/libraries/System.Runtime.InteropServices/Directory.Build.props b/src/libraries/System.Runtime.InteropServices/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.Runtime.InteropServices/Directory.Build.props +++ b/src/libraries/System.Runtime.InteropServices/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs index d85496a25ae18a..62a71240547237 100644 --- a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs +++ b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs @@ -316,6 +316,7 @@ public DefaultParameterValueAttribute(object? value) { } public sealed partial class DispatchWrapper { public DispatchWrapper(object? obj) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public object? WrappedObject { get { throw null; } } } [System.AttributeUsageAttribute(System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)] @@ -461,12 +462,15 @@ public static partial class Marshal { public static readonly int SystemDefaultCharSize; public static readonly int SystemMaxDBCSCharSize; + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static int AddRef(System.IntPtr pUnk) { throw null; } public static System.IntPtr AllocCoTaskMem(int cb) { throw null; } public static System.IntPtr AllocHGlobal(int cb) { throw null; } public static System.IntPtr AllocHGlobal(System.IntPtr cb) { throw null; } public static bool AreComObjectsAvailableForCleanup() { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static object BindToMoniker(string monikerName) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak) { } public static void CleanupUnusedObjectsInCurrentContext() { } public static void Copy(byte[] source, int startIndex, System.IntPtr destination, int length) { } @@ -485,31 +489,40 @@ public static void Copy(System.IntPtr source, System.IntPtr[] destination, int s public static void Copy(System.IntPtr source, float[] destination, int startIndex, int length) { } public static void Copy(System.IntPtr[] source, int startIndex, System.IntPtr destination, int length) { } public static void Copy(float[] source, int startIndex, System.IntPtr destination, int length) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static System.IntPtr CreateAggregatedObject(System.IntPtr pOuter, object o) { throw null; } public static System.IntPtr CreateAggregatedObject(System.IntPtr pOuter, T o) where T : notnull { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("o")] public static object? CreateWrapperOfType(object? o, System.Type t) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static TWrapper CreateWrapperOfType([System.Diagnostics.CodeAnalysis.AllowNullAttribute] T o) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static void DestroyStructure(System.IntPtr ptr, System.Type structuretype) { } public static void DestroyStructure(System.IntPtr ptr) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static int FinalReleaseComObject(object o) { throw null; } public static void FreeBSTR(System.IntPtr ptr) { } public static void FreeCoTaskMem(System.IntPtr ptr) { } public static void FreeHGlobal(System.IntPtr hglobal) { } public static System.Guid GenerateGuidForType(System.Type type) { throw null; } public static string? GenerateProgIdForType(System.Type type) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static System.IntPtr GetComInterfaceForObject(object o, System.Type T) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static System.IntPtr GetComInterfaceForObject(object o, System.Type T, System.Runtime.InteropServices.CustomQueryInterfaceMode mode) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IntPtr GetComInterfaceForObject([System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T o) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static object? GetComObjectData(object obj, object key) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static System.Delegate GetDelegateForFunctionPointer(System.IntPtr ptr, System.Type t) { throw null; } public static TDelegate GetDelegateForFunctionPointer(System.IntPtr ptr) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static int GetEndComSlot(System.Type t) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("GetExceptionCode() may be unavailable in future releases.")] @@ -523,27 +536,41 @@ public static void FreeHGlobal(System.IntPtr hglobal) { } public static System.IntPtr GetHINSTANCE(System.Reflection.Module m) { throw null; } public static int GetHRForException(System.Exception? e) { throw null; } public static int GetHRForLastWin32Error() { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IntPtr GetIDispatchForObject(object o) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.IntPtr GetIUnknownForObject(object o) { throw null; } public static int GetLastWin32Error() { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static void GetNativeVariantForObject(object? obj, System.IntPtr pDstNativeVariant) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static void GetNativeVariantForObject([System.Diagnostics.CodeAnalysis.AllowNullAttribute] T obj, System.IntPtr pDstNativeVariant) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static object GetObjectForIUnknown(System.IntPtr pUnk) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static object? GetObjectForNativeVariant(System.IntPtr pSrcNativeVariant) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute] public static T GetObjectForNativeVariant(System.IntPtr pSrcNativeVariant) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static object?[] GetObjectsForNativeVariants(System.IntPtr aSrcNativeVariant, int cVars) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static T[] GetObjectsForNativeVariants(System.IntPtr aSrcNativeVariant, int cVars) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static int GetStartComSlot(System.Type t) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static object GetTypedObjectForIUnknown(System.IntPtr pUnk, System.Type t) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.Type GetTypeFromCLSID(System.Guid clsid) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static string GetTypeInfoName(System.Runtime.InteropServices.ComTypes.ITypeInfo typeInfo) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static object GetUniqueObjectForIUnknown(System.IntPtr unknown) { throw null; } public static bool IsComObject(object o) { throw null; } public static bool IsTypeVisibleFromCom(System.Type t) { throw null; } @@ -568,6 +595,7 @@ public static void PtrToStructure(System.IntPtr ptr, object structure) { } [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute] public static T PtrToStructure(System.IntPtr ptr) { throw null; } public static void PtrToStructure(System.IntPtr ptr, [System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T structure) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static int QueryInterface(System.IntPtr pUnk, ref System.Guid iid, out System.IntPtr ppv) { throw null; } public static byte ReadByte(System.IntPtr ptr) { throw null; } public static byte ReadByte(System.IntPtr ptr, int ofs) { throw null; } @@ -596,13 +624,16 @@ public static void PtrToStructure(System.IntPtr ptr, [System.Diagnostics.Code public static System.IntPtr ReadIntPtr(object ptr, int ofs) { throw null; } public static System.IntPtr ReAllocCoTaskMem(System.IntPtr pv, int cb) { throw null; } public static System.IntPtr ReAllocHGlobal(System.IntPtr pv, System.IntPtr cb) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static int Release(System.IntPtr pUnk) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static int ReleaseComObject(object o) { throw null; } public static System.IntPtr SecureStringToBSTR(System.Security.SecureString s) { throw null; } public static System.IntPtr SecureStringToCoTaskMemAnsi(System.Security.SecureString s) { throw null; } public static System.IntPtr SecureStringToCoTaskMemUnicode(System.Security.SecureString s) { throw null; } public static System.IntPtr SecureStringToGlobalAllocAnsi(System.Security.SecureString s) { throw null; } public static System.IntPtr SecureStringToGlobalAllocUnicode(System.Security.SecureString s) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static bool SetComObjectData(object obj, object key, object? data) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static int SizeOf(object structure) { throw null; } diff --git a/src/libraries/System.Security.AccessControl/Directory.Build.props b/src/libraries/System.Security.AccessControl/Directory.Build.props index 8c72c62fd5932e..27a4a5522a2778 100644 --- a/src/libraries/System.Security.AccessControl/Directory.Build.props +++ b/src/libraries/System.Security.AccessControl/Directory.Build.props @@ -4,5 +4,6 @@ Microsoft true false + true \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props b/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props index 8c72c62fd5932e..27a4a5522a2778 100644 --- a/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props @@ -4,5 +4,6 @@ Microsoft true false + true \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props b/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index 88a0df051053b3..f4bbc111fbe3b7 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -27,6 +27,7 @@ protected override void Dispose(bool disposing) { } public override void GenerateIV() { } public override void GenerateKey() { } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public sealed partial class CspKeyContainerInfo { public CspKeyContainerInfo(System.Security.Cryptography.CspParameters parameters) { } @@ -86,8 +87,11 @@ public sealed partial class DSACryptoServiceProvider : System.Security.Cryptogra { public DSACryptoServiceProvider() { } public DSACryptoServiceProvider(int dwKeySize) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public DSACryptoServiceProvider(int dwKeySize, System.Security.Cryptography.CspParameters? parameters) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public DSACryptoServiceProvider(System.Security.Cryptography.CspParameters? parameters) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public System.Security.Cryptography.CspKeyContainerInfo CspKeyContainerInfo { get { throw null; } } public override string? KeyExchangeAlgorithm { get { throw null; } } public override int KeySize { get { throw null; } } @@ -148,6 +152,7 @@ public PasswordDeriveBytes(string strPassword, byte[]? rgbSalt, string strHashNa public string HashName { get { throw null; } set { } } public int IterationCount { get { throw null; } set { } } public byte[]? Salt { get { throw null; } set { } } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public byte[] CryptDeriveKey(string? algname, string? alghashname, int keySize, byte[] rgbIV) { throw null; } protected override void Dispose(bool disposing) { } [System.ObsoleteAttribute("Rfc2898DeriveBytes replaces PasswordDeriveBytes for deriving key material from a password and is preferred in new applications.")] @@ -159,7 +164,7 @@ public sealed partial class RC2CryptoServiceProvider : System.Security.Cryptogra { public RC2CryptoServiceProvider() { } public override int EffectiveKeySize { get { throw null; } set { } } - public bool UseSalt { get { throw null; } set { } } + public bool UseSalt { get { throw null; } [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] set { } } public override System.Security.Cryptography.ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } public override System.Security.Cryptography.ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV) { throw null; } public override void GenerateIV() { } @@ -183,8 +188,11 @@ public sealed partial class RSACryptoServiceProvider : System.Security.Cryptogra { public RSACryptoServiceProvider() { } public RSACryptoServiceProvider(int dwKeySize) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public RSACryptoServiceProvider(int dwKeySize, System.Security.Cryptography.CspParameters? parameters) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public RSACryptoServiceProvider(System.Security.Cryptography.CspParameters? parameters) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public System.Security.Cryptography.CspKeyContainerInfo CspKeyContainerInfo { get { throw null; } } public override string? KeyExchangeAlgorithm { get { throw null; } } public override int KeySize { get { throw null; } } diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Unix.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Unix.cs index b2f7c83fd85c95..843352987a4c6d 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Unix.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Unix.cs @@ -1,8 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.Security.Cryptography { + [MinimumOSPlatform("windows7.0")] public sealed class CspKeyContainerInfo { public CspKeyContainerInfo(CspParameters parameters) { throw GetPlatformNotSupported(); } diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs index 149551b73d9906..25021e88630d1b 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CspKeyContainerInfo.Windows.cs @@ -3,9 +3,11 @@ using Internal.NativeCrypto; using Microsoft.Win32.SafeHandles; +using System.Runtime.Versioning; namespace System.Security.Cryptography { + [MinimumOSPlatform("windows7.0")] public sealed class CspKeyContainerInfo { private readonly CspParameters _parameters; diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs index 325c6513b3e70a..74811cb089eea0 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs @@ -5,6 +5,7 @@ using Internal.NativeCrypto; using System.IO; using System.Diagnostics; +using System.Runtime.Versioning; namespace System.Security.Cryptography { @@ -37,11 +38,13 @@ public DSACryptoServiceProvider(int dwKeySize) : base() KeySize = dwKeySize; } + [MinimumOSPlatform("windows7.0")] public DSACryptoServiceProvider(int dwKeySize, CspParameters parameters) { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters))); } + [MinimumOSPlatform("windows7.0")] public DSACryptoServiceProvider(CspParameters parameters) { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters))); @@ -53,6 +56,7 @@ public DSACryptoServiceProvider(CspParameters parameters) public override bool TryCreateSignature(ReadOnlySpan hash, Span destination, out int bytesWritten) => _impl.TryCreateSignature(hash, destination, out bytesWritten); + [MinimumOSPlatform("windows7.0")] public CspKeyContainerInfo CspKeyContainerInfo { get { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); } diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Windows.cs index c9a58c238045b9..686728e6a52229 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Windows.cs @@ -4,6 +4,7 @@ using System.Buffers.Binary; using System.Diagnostics; using System.IO; +using System.Runtime.Versioning; using Internal.NativeCrypto; namespace System.Security.Cryptography @@ -49,6 +50,7 @@ public DSACryptoServiceProvider(int dwKeySize) /// for the cryptographic service provider (CSP). /// /// The parameters for the CSP. + [MinimumOSPlatform("windows7.0")] public DSACryptoServiceProvider(CspParameters? parameters) : this(0, parameters) { @@ -61,6 +63,7 @@ public DSACryptoServiceProvider(CspParameters? parameters) /// The size of the key for the cryptographic algorithm in bits. /// The parameters for the CSP. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 is required by the FIPS 186-2 DSA spec.")] + [MinimumOSPlatform("windows7.0")] public DSACryptoServiceProvider(int dwKeySize, CspParameters? parameters) { if (dwKeySize < 0) @@ -182,6 +185,7 @@ private SafeKeyHandle SafeKeyHandle /// /// Gets a CspKeyContainerInfo object that describes additional information about a cryptographic key pair. /// + [MinimumOSPlatform("windows7.0")] public CspKeyContainerInfo CspKeyContainerInfo { get diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Unix.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Unix.cs index f2ee01b6c042fd..2627057a7bb501 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Unix.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Unix.cs @@ -1,10 +1,13 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.Versioning; + namespace System.Security.Cryptography { public partial class PasswordDeriveBytes : DeriveBytes { + [MinimumOSPlatform("windows7.0")] public byte[] CryptDeriveKey(string? algname, string? alghashname, int keySize, byte[] rgbIV) { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CryptDeriveKey))); diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Windows.cs index 7fa944a7303f19..58c546e62b27f6 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.Windows.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Internal.NativeCrypto; +using System.Runtime.Versioning; #pragma warning disable CA5373 // Call to obsolete key derivation function PasswordDeriveBytes.* @@ -11,6 +12,7 @@ public partial class PasswordDeriveBytes : DeriveBytes { private SafeProvHandle? _safeProvHandle; + [MinimumOSPlatform("windows7.0")] public byte[] CryptDeriveKey(string? algname, string? alghashname, int keySize, byte[] rgbIV) { if (keySize < 0) diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs index 02661fec440472..3cab2033995ba6 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Internal.Cryptography; +using System.Runtime.Versioning; namespace System.Security.Cryptography { @@ -103,6 +104,7 @@ public override PaddingMode Padding public bool UseSalt { get { return false; } + [MinimumOSPlatform("windows7.0")] set { // Don't allow a true value diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs index c9b4e7088fb83d..a7c1c42084e32a 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs @@ -4,6 +4,7 @@ using Internal.Cryptography; using Internal.NativeCrypto; using System.ComponentModel; +using System.Runtime.Versioning; namespace System.Security.Cryptography { @@ -43,6 +44,7 @@ public bool UseSalt { return _use40bitSalt; } + [MinimumOSPlatform("windows7.0")] set { _use40bitSalt = value; diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs index 8cc80fa86d2855..d36a068c80b398 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs @@ -4,6 +4,7 @@ using Internal.Cryptography; using Internal.NativeCrypto; using System.IO; +using System.Runtime.Versioning; namespace System.Security.Cryptography { @@ -26,12 +27,15 @@ public RSACryptoServiceProvider(int dwKeySize) _impl = RSA.Create(dwKeySize); } + [MinimumOSPlatform("windows7.0")] public RSACryptoServiceProvider(int dwKeySize, CspParameters parameters) => throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters))); + [MinimumOSPlatform("windows7.0")] public RSACryptoServiceProvider(CspParameters parameters) => throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters))); + [MinimumOSPlatform("windows7.0")] public CspKeyContainerInfo CspKeyContainerInfo => throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs index c3fb318504f585..7a22b937cd52da 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.IO; +using System.Runtime.Versioning; using Internal.Cryptography; using Internal.NativeCrypto; using Microsoft.Win32.SafeHandles; @@ -38,11 +39,13 @@ public RSACryptoServiceProvider(int dwKeySize) { } + [MinimumOSPlatform("windows7.0")] public RSACryptoServiceProvider(int dwKeySize, CspParameters? parameters) : this(dwKeySize, parameters, false) { } + [MinimumOSPlatform("windows7.0")] public RSACryptoServiceProvider(CspParameters? parameters) : this(0, parameters, true) { @@ -170,6 +173,7 @@ private SafeKeyHandle SafeKeyHandle /// /// CspKeyContainerInfo property /// + [MinimumOSPlatform("windows7.0")] public CspKeyContainerInfo CspKeyContainerInfo { get diff --git a/src/libraries/System.Security.Cryptography.ProtectedData/Directory.Build.props b/src/libraries/System.Security.Cryptography.ProtectedData/Directory.Build.props index 63f02a0f817ef2..33e65b7cb46516 100644 --- a/src/libraries/System.Security.Cryptography.ProtectedData/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.ProtectedData/Directory.Build.props @@ -2,5 +2,6 @@ Microsoft + true \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props b/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props index 465e1110d6b07f..42c6eafce67ed8 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs b/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs index f133b0ef09ce13..07b51c0d456c0c 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs @@ -332,6 +332,7 @@ public partial class X509Chain : System.IDisposable { public X509Chain() { } public X509Chain(bool useMachineContext) { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public X509Chain(System.IntPtr chainContext) { } public System.IntPtr ChainContext { get { throw null; } } public System.Security.Cryptography.X509Certificates.X509ChainElementCollection ChainElements { get { throw null; } } diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs index 52e7cce49ff183..51d4001e2d5151 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs @@ -4,6 +4,7 @@ using SafeX509ChainHandle = Microsoft.Win32.SafeHandles.SafeX509ChainHandle; using Internal.Cryptography.Pal; using System.Diagnostics; +using System.Runtime.Versioning; namespace System.Security.Cryptography.X509Certificates { @@ -23,6 +24,7 @@ public X509Chain(bool useMachineContext) _useMachineContext = useMachineContext; } + [MinimumOSPlatform("windows7.0")] public X509Chain(IntPtr chainContext) { _pal = ChainPal.FromHandle(chainContext); diff --git a/src/libraries/System.Security.Principal.Windows/Directory.Build.props b/src/libraries/System.Security.Principal.Windows/Directory.Build.props index 8c72c62fd5932e..27a4a5522a2778 100644 --- a/src/libraries/System.Security.Principal.Windows/Directory.Build.props +++ b/src/libraries/System.Security.Principal.Windows/Directory.Build.props @@ -4,5 +4,6 @@ Microsoft true false + true \ No newline at end of file diff --git a/src/libraries/System.ServiceProcess.ServiceController/Directory.Build.props b/src/libraries/System.ServiceProcess.ServiceController/Directory.Build.props index 63f02a0f817ef2..33e65b7cb46516 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/Directory.Build.props +++ b/src/libraries/System.ServiceProcess.ServiceController/Directory.Build.props @@ -2,5 +2,6 @@ Microsoft + true \ No newline at end of file diff --git a/src/libraries/System.Threading.AccessControl/Directory.Build.props b/src/libraries/System.Threading.AccessControl/Directory.Build.props index 63f02a0f817ef2..33e65b7cb46516 100644 --- a/src/libraries/System.Threading.AccessControl/Directory.Build.props +++ b/src/libraries/System.Threading.AccessControl/Directory.Build.props @@ -2,5 +2,6 @@ Microsoft + true \ No newline at end of file diff --git a/src/libraries/System.Threading.Overlapped/Directory.Build.props b/src/libraries/System.Threading.Overlapped/Directory.Build.props index 465e1110d6b07f..0f058f12cba861 100644 --- a/src/libraries/System.Threading.Overlapped/Directory.Build.props +++ b/src/libraries/System.Threading.Overlapped/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + true \ No newline at end of file diff --git a/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs b/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs index a2ef24a9bcba9e..142afdea8ec2a2 100644 --- a/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs +++ b/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs @@ -78,6 +78,7 @@ public static void MemoryBarrier() { } public static void ResetAbort() { } [System.ObsoleteAttribute("Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. https://go.microsoft.com/fwlink/?linkid=14202", false)] public void Resume() { } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public void SetApartmentState(System.Threading.ApartmentState state) { } [System.ObsoleteAttribute("Thread.SetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")] public void SetCompressedStack(System.Threading.CompressedStack stack) { } diff --git a/src/libraries/System.Threading/ref/System.Threading.cs b/src/libraries/System.Threading/ref/System.Threading.cs index 98124d734c498f..d0f85e23252df2 100644 --- a/src/libraries/System.Threading/ref/System.Threading.cs +++ b/src/libraries/System.Threading/ref/System.Threading.cs @@ -115,9 +115,11 @@ public partial class EventWaitHandle : System.Threading.WaitHandle public EventWaitHandle(bool initialState, System.Threading.EventResetMode mode) { } public EventWaitHandle(bool initialState, System.Threading.EventResetMode mode, string? name) { } public EventWaitHandle(bool initialState, System.Threading.EventResetMode mode, string? name, out bool createdNew) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.Threading.EventWaitHandle OpenExisting(string name) { throw null; } public bool Reset() { throw null; } public bool Set() { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static bool TryOpenExisting(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Threading.EventWaitHandle? result) { throw null; } } public sealed partial class ExecutionContext : System.IDisposable, System.Runtime.Serialization.ISerializable @@ -348,9 +350,11 @@ public sealed partial class Semaphore : System.Threading.WaitHandle public Semaphore(int initialCount, int maximumCount) { } public Semaphore(int initialCount, int maximumCount, string? name) { } public Semaphore(int initialCount, int maximumCount, string? name, out bool createdNew) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static System.Threading.Semaphore OpenExisting(string name) { throw null; } public int Release() { throw null; } public int Release(int releaseCount) { throw null; } + [System.Runtime.Versioning.MinimumOSPlatformAttribute("windows7.0")] public static bool TryOpenExisting(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Threading.Semaphore? result) { throw null; } } public partial class SemaphoreFullException : System.SystemException