remove pragma warning from ref source files (#38907)
authorAnirudh Agnihotry <anirudhagnihotry098@gmail.com>
Thu, 9 Jul 2020 01:33:44 +0000 (18:33 -0700)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2020 01:33:44 +0000 (18:33 -0700)
24 files changed:
src/libraries/Microsoft.Extensions.Hosting.Abstractions/ref/Microsoft.Extensions.Hosting.Abstractions.cs
src/libraries/Microsoft.Extensions.Hosting.Abstractions/ref/Microsoft.Extensions.Hosting.Abstractions.csproj
src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.cs
src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.csproj
src/libraries/System.Collections.NonGeneric/ref/System.Collections.NonGeneric.Forwards.cs
src/libraries/System.Collections.NonGeneric/ref/System.Collections.NonGeneric.csproj
src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs
src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj
src/libraries/System.Linq.Expressions/ref/System.Linq.Expressions.cs
src/libraries/System.Linq.Expressions/ref/System.Linq.Expressions.csproj
src/libraries/System.Net.Requests/ref/System.Net.Requests.cs
src/libraries/System.Net.Requests/ref/System.Net.Requests.csproj
src/libraries/System.Net.WebHeaderCollection/ref/System.Net.WebHeaderCollection.cs
src/libraries/System.Net.WebHeaderCollection/ref/System.Net.WebHeaderCollection.csproj
src/libraries/System.Runtime.Extensions/ref/System.Runtime.Extensions.Forwards.cs
src/libraries/System.Runtime.Extensions/ref/System.Runtime.Extensions.csproj
src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.csproj
src/libraries/System.Runtime/ref/System.Runtime.cs
src/libraries/System.Runtime/ref/System.Runtime.csproj
src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs
src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.csproj
src/libraries/System.Text.Encodings.Web/ref/System.Text.Encodings.Web.cs
src/libraries/System.Text.Encodings.Web/ref/System.Text.Encodings.Web.csproj

index 226be0e..2d573c5 100644 (file)
@@ -71,12 +71,10 @@ namespace Microsoft.Extensions.Hosting
     }
     public static partial class HostingEnvironmentExtensions
     {
-#pragma warning disable CS0618 // Type or member is obsolete
         public static bool IsDevelopment(this Microsoft.Extensions.Hosting.IHostingEnvironment hostingEnvironment) { throw null; }
         public static bool IsEnvironment(this Microsoft.Extensions.Hosting.IHostingEnvironment hostingEnvironment, string environmentName) { throw null; }
         public static bool IsProduction(this Microsoft.Extensions.Hosting.IHostingEnvironment hostingEnvironment) { throw null; }
         public static bool IsStaging(this Microsoft.Extensions.Hosting.IHostingEnvironment hostingEnvironment) { throw null; }
-#pragma warning restore CS0618 // Type or member is obsolete
     }
     [System.ObsoleteAttribute("This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.IHostApplicationLifetime.", false)]
     public partial interface IApplicationLifetime
index 3220cd2..cd10bfb 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0618</NoWarn>
   </PropertyGroup>
   <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
     <Reference Include="Microsoft.Bcl.AsyncInterfaces"  />
index 3d31c1f..5921645 100644 (file)
@@ -52,9 +52,7 @@ namespace Microsoft.Extensions.Hosting
 }
 namespace Microsoft.Extensions.Hosting.Internal
 {
-#pragma warning disable CS0618 // Type or member is obsolete
     public partial class ApplicationLifetime : Microsoft.Extensions.Hosting.IApplicationLifetime, Microsoft.Extensions.Hosting.IHostApplicationLifetime
-#pragma warning restore CS0618 // Type or member is obsolete
     {
         public ApplicationLifetime(Microsoft.Extensions.Logging.ILogger<Microsoft.Extensions.Hosting.Internal.ApplicationLifetime> logger) { }
         public System.Threading.CancellationToken ApplicationStarted { get { throw null; } }
@@ -72,9 +70,7 @@ namespace Microsoft.Extensions.Hosting.Internal
         public System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
         public System.Threading.Tasks.Task WaitForStartAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
     }
-#pragma warning disable CS0618 // Type or member is obsolete
     public partial class HostingEnvironment : Microsoft.Extensions.Hosting.IHostEnvironment, Microsoft.Extensions.Hosting.IHostingEnvironment
-#pragma warning restore CS0618 // Type or member is obsolete
     {
         public HostingEnvironment() { }
         public string ApplicationName { get { throw null; } set { } }
index b6d0d8e..8f69092 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0618</NoWarn>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="Microsoft.Extensions.Hosting.cs" />
index fbc24b0..fcd868f 100644 (file)
@@ -7,6 +7,4 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.ArrayList))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Comparer))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Hashtable))]
-#pragma warning disable 0618
 [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.IHashCodeProvider))]
-#pragma warning restore 0618
index e944d85..84646e6 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
+    <NoWarn>$(NoWarn);0618</NoWarn>
     <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
index 8e5e826..95a27a2 100644 (file)
@@ -267,7 +267,6 @@ namespace System.Configuration
     }
     public partial class ConfigurationErrorsException : System.Configuration.ConfigurationException
     {
-#pragma warning disable CS0618
         public ConfigurationErrorsException() { }
         protected ConfigurationErrorsException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
         public ConfigurationErrorsException(string message) { }
@@ -278,7 +277,6 @@ namespace System.Configuration
         public ConfigurationErrorsException(string message, string filename, int line) { }
         public ConfigurationErrorsException(string message, System.Xml.XmlNode node) { }
         public ConfigurationErrorsException(string message, System.Xml.XmlReader reader) { }
-#pragma warning restore CS0618
         public override string BareMessage { get { throw null; } }
         public System.Collections.ICollection Errors { get { throw null; } }
         public override string Filename { get { throw null; } }
index 36c4439..d4a6743 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;net461;$(NetFrameworkCurrent)</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0618</NoWarn>
     <ExcludeCurrentFullFrameworkFromPackage>true</ExcludeCurrentFullFrameworkFromPackage>
   </PropertyGroup>
   <!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
index 363f043..d26f21a 100644 (file)
@@ -946,9 +946,7 @@ namespace System.Linq.Expressions
     }
     public sealed partial class MemberAssignment : System.Linq.Expressions.MemberBinding
     {
-#pragma warning disable CS0618
         internal MemberAssignment() : base (default(System.Linq.Expressions.MemberBindingType), default(System.Reflection.MemberInfo)) { }
-#pragma warning restore CS0618
         public System.Linq.Expressions.Expression Expression { get { throw null; } }
         public System.Linq.Expressions.MemberAssignment Update(System.Linq.Expressions.Expression expression) { throw null; }
     }
@@ -989,17 +987,13 @@ namespace System.Linq.Expressions
     }
     public sealed partial class MemberListBinding : System.Linq.Expressions.MemberBinding
     {
-#pragma warning disable CS0618
         internal MemberListBinding() : base (default(System.Linq.Expressions.MemberBindingType), default(System.Reflection.MemberInfo)) { }
-#pragma warning restore CS0618
         public System.Collections.ObjectModel.ReadOnlyCollection<System.Linq.Expressions.ElementInit> Initializers { get { throw null; } }
         public System.Linq.Expressions.MemberListBinding Update(System.Collections.Generic.IEnumerable<System.Linq.Expressions.ElementInit> initializers) { throw null; }
     }
     public sealed partial class MemberMemberBinding : System.Linq.Expressions.MemberBinding
     {
-#pragma warning disable CS0618
         internal MemberMemberBinding() : base (default(System.Linq.Expressions.MemberBindingType), default(System.Reflection.MemberInfo)) { }
-#pragma warning restore CS0618
         public System.Collections.ObjectModel.ReadOnlyCollection<System.Linq.Expressions.MemberBinding> Bindings { get { throw null; } }
         public System.Linq.Expressions.MemberMemberBinding Update(System.Collections.Generic.IEnumerable<System.Linq.Expressions.MemberBinding> bindings) { throw null; }
     }
index 2c5026e..0242881 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0618</NoWarn>
     <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
index ed7cf7c..9b220cf 100644 (file)
@@ -230,10 +230,8 @@ namespace System.Net
         public override System.IO.Stream EndGetRequestStream(System.IAsyncResult asyncResult) { throw null; }
         public System.IO.Stream EndGetRequestStream(System.IAsyncResult asyncResult, out System.Net.TransportContext? context) { throw null; }
         public override System.Net.WebResponse EndGetResponse(System.IAsyncResult asyncResult) { throw null; }
-#pragma warning disable 0809 // Obsolete member overrides non-obsolete member
         [System.ObsoleteAttribute("Serialization is obsoleted for this type.  https://go.microsoft.com/fwlink/?linkid=14202")]
         protected override void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
-#pragma warning restore 0809
         public override System.IO.Stream GetRequestStream() { throw null; }
         public System.IO.Stream GetRequestStream(out System.Net.TransportContext? context) { throw null; }
         public override System.Net.WebResponse GetResponse() { throw null; }
@@ -264,10 +262,8 @@ namespace System.Net
         public override bool SupportsHeaders { get { throw null; } }
         public override void Close() { }
         protected override void Dispose(bool disposing) { }
-#pragma warning disable 0809 // Obsolete member overrides non-obsolete member
         [System.ObsoleteAttribute("Serialization is obsoleted for this type.  https://go.microsoft.com/fwlink/?linkid=14202")]
         protected override void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
-#pragma warning restore 0809
         public string GetResponseHeader(string headerName) { throw null; }
         public override System.IO.Stream GetResponseStream() { throw null; }
         [System.ObsoleteAttribute("Serialization is obsoleted for this type.  https://go.microsoft.com/fwlink/?linkid=14202")]
index a351366..4f4b8e8 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0809</NoWarn>
     <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
index bf873d9..297dc1d 100644 (file)
@@ -95,9 +95,7 @@ namespace System.Net
         public void Add(System.Net.HttpRequestHeader header, string? value) { }
         public void Add(System.Net.HttpResponseHeader header, string? value) { }
         public void Add(string header) { }
-#pragma warning disable CS8765 // Nullability of parameter 'name' doesn't match overridden member
         public override void Add(string name, string? value) { }
-#pragma warning restore CS8765
         protected void AddWithoutValidate(string headerName, string? headerValue) { }
         public override void Clear() { }
         public override string? Get(int index) { throw null; }
@@ -106,22 +104,16 @@ namespace System.Net
         public override string GetKey(int index) { throw null; }
         public override void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
         public override string[]? GetValues(int index) { throw null; }
-#pragma warning disable CS8765 // Nullability of parameter 'header' doesn't match overridden member
         public override string[]? GetValues(string header) { throw null; }
-#pragma warning restore CS8765
         public static bool IsRestricted(string headerName) { throw null; }
         public static bool IsRestricted(string headerName, bool response) { throw null; }
         public override void OnDeserialization(object? sender) { }
         public void Remove(System.Net.HttpRequestHeader header) { }
         public void Remove(System.Net.HttpResponseHeader header) { }
-#pragma warning disable CS8765 // Nullability of parameter 'name' doesn't match overridden member
         public override void Remove(string name) { }
-#pragma warning restore CS8765
         public void Set(System.Net.HttpRequestHeader header, string? value) { }
         public void Set(System.Net.HttpResponseHeader header, string? value) { }
-#pragma warning disable CS8765 // Nullability of parameter 'name' doesn't match overridden member
         public override void Set(string name, string? value) { }
-#pragma warning restore CS8765
         void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
         public byte[] ToByteArray() { throw null; }
         public override string ToString() { throw null; }
index a54d71f..f072606 100644 (file)
@@ -2,6 +2,8 @@
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
     <Nullable>enable</Nullable>
+     <!-- Nullability of parameter 'name' doesn't match overridden member -->
+    <NoWarn>$(NoWarn);CS8765</NoWarn>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="System.Net.WebHeaderCollection.cs" />
index a6dde86..62e356f 100644 (file)
@@ -4,8 +4,6 @@
 // Changes to this file must follow the https://aka.ms/api-review process.
 // ------------------------------------------------------------------------------
 
-#pragma warning disable 0618
-
 [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.AppDomain))]
 [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.AppDomainSetup))]
 [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.AppDomainUnloadedException))]
index 1b83901..32152c7 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0618</NoWarn>
     <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
index e69b2f2..cfdb131 100644 (file)
@@ -180,9 +180,7 @@ namespace System.Runtime.InteropServices
         public override System.Reflection.Module Module { get { throw null; } }
         public override string Name { get { throw null; } }
         public override System.Type? ReflectedType { get { throw null; } }
-#pragma warning disable CS8765 // Nullability of parameters 'target' and 'handler' don't match overridden member
         public override void AddEventHandler(object target, System.Delegate handler) { }
-#pragma warning restore CS8765
         public override System.Reflection.MethodInfo? GetAddMethod(bool nonPublic) { throw null; }
         public override object[] GetCustomAttributes(bool inherit) { throw null; }
         public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
@@ -191,9 +189,7 @@ namespace System.Runtime.InteropServices
         public override System.Reflection.MethodInfo? GetRaiseMethod(bool nonPublic) { throw null; }
         public override System.Reflection.MethodInfo? GetRemoveMethod(bool nonPublic) { throw null; }
         public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
-#pragma warning disable CS8765 // Nullability of parameters 'target' and 'handler' don't match overridden member
         public override void RemoveEventHandler(object target, System.Delegate handler) { }
-#pragma warning restore CS8765
     }
     [System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
     public sealed partial class ComCompatibleVersionAttribute : System.Attribute
index 2fd2200..f253361 100644 (file)
@@ -2,7 +2,8 @@
   <PropertyGroup>
     <!-- Don't warn about usage of obsolete API since the contract must keep its own references
          to its own obsolete API. -->
-    <NoWarn>$(NoWarn);618</NoWarn>
+    <!-- Nullability of parameter 'name' doesn't match overridden member -->
+    <NoWarn>$(NoWarn);618;CS8765</NoWarn>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
     <Nullable>enable</Nullable>
index ee91e1d..4d70863 100644 (file)
@@ -3606,9 +3606,7 @@ namespace System
         public abstract bool Equals(string? x, string? y);
         public static System.StringComparer FromComparison(System.StringComparison comparisonType) { throw null; }
         public int GetHashCode(object obj) { throw null; }
-#pragma warning disable CS8614 // Remove warning disable when nullable attributes are respected
         public abstract int GetHashCode(string obj);
-#pragma warning restore CS8614
     }
     public enum StringComparison
     {
@@ -9927,9 +9925,7 @@ namespace System.Runtime.Versioning
         public string? Message { get; }
         public string? Url { get; set; }
     }
-#pragma warning disable CS3015 // Type has no accessible constructors which use only CLS-compliant types
     public abstract class OSPlatformAttribute : System.Attribute
-#pragma warning restore CS3015 // Type has no accessible constructors which use only CLS-compliant types
     {
         private protected OSPlatformAttribute(string platformName) { }
         public string PlatformName { get; }
index 05b8fde..9a05ef6 100644 (file)
@@ -3,8 +3,10 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <!-- It is a core assembly because it defines System.Object so we need to pass RuntimeMetadataVersion to the compiler -->
     <RuntimeMetadataVersion>v4.0.30319</RuntimeMetadataVersion>
-    <!-- disable warnings about obsolete APIs -->
-    <NoWarn>$(NoWarn);0809;0618</NoWarn>
+    <!-- disable warnings about obsolete APIs,
+        Remove warning disable when nullable attributes are respected,
+        Type has no accessible constructors which use only CLS-compliant types -->
+    <NoWarn>$(NoWarn);0809;0618;CS8614;CS3015</NoWarn>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
     <Nullable>enable</Nullable>
   </PropertyGroup>
index 9276764..88a0df0 100644 (file)
@@ -150,10 +150,8 @@ namespace System.Security.Cryptography
         public byte[]? Salt { get { throw null; } set { } }
         public byte[] CryptDeriveKey(string? algname, string? alghashname, int keySize, byte[] rgbIV) { throw null; }
         protected override void Dispose(bool disposing) { }
-#pragma warning disable 0809
         [System.ObsoleteAttribute("Rfc2898DeriveBytes replaces PasswordDeriveBytes for deriving key material from a password and is preferred in new applications.")]
         public override byte[] GetBytes(int cb) { throw null; }
-#pragma warning restore 0809
         public override void Reset() { }
     }
     [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
index c12467a..7adf543 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
+    <NoWarn>$(NoWarn);CS0809</NoWarn>
     <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
index 65becd8..f38e07b 100644 (file)
@@ -4,8 +4,6 @@
 // Changes to this file must follow the https://aka.ms/api-review process.
 // ------------------------------------------------------------------------------
 
-#pragma warning disable CS3011 // Only CLS-compliant members can be abstract
-
 namespace System.Text.Encodings.Web
 {
     public abstract partial class HtmlEncoder : System.Text.Encodings.Web.TextEncoder
index a587f8a..92d9579 100644 (file)
@@ -3,6 +3,8 @@
     <TargetFrameworks>$(NetCoreAppCurrent);netstandard2.0</TargetFrameworks>
     <ExcludeCurrentNetCoreAppFromPackage>true</ExcludeCurrentNetCoreAppFromPackage>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <!-- Only CLS-compliant members can be abstract -->
+    <NoWarn>$(NoWarn);CS3011</NoWarn>
     <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>