Enable CS1591 for projects that don't use intellisense package XML file (#84917)
authorViktor Hofer <viktor.hofer@microsoft.com>
Sat, 17 Jun 2023 07:35:30 +0000 (09:35 +0200)
committerGitHub <noreply@github.com>
Sat, 17 Jun 2023 07:35:30 +0000 (09:35 +0200)
* Enable CS1591 for projects that don't use intellisense package XML file

* Update Directory.Build.targets

* Update Directory.Build.targets

* Update intellisense.targets

* Update intellisense.targets

* Update Microsoft.NETCore.Platforms.csproj

* Backport docs: Microsoft.Extensions.Hosting.WindowsServices

* Backport docs: Microsoft.Extensions.Hosting.Systemd

* Remove unnecessary full namespaces in triple slash.

* Fix xml comment formatting.

* Update System.Numerics.Tensors.csproj

* Update Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj

* Update System.Threading.RateLimiting.csproj

* Update WindowsServiceLifetimeOptions.cs

* Update SystemdNotifier.cs

* Update Microsoft.Bcl.AsyncInterfaces.csproj

* Update System.Speech.csproj

* Update System.Threading.RateLimiting.csproj

---------

Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
13 files changed:
eng/intellisense.targets
src/libraries/Microsoft.Bcl.AsyncInterfaces/src/Microsoft.Bcl.AsyncInterfaces.csproj
src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj
src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdHelpers.cs
src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs
src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs
src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceHelpers.cs
src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs
src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetimeOptions.cs
src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj
src/libraries/System.Speech/src/System.Speech.csproj
src/libraries/System.Threading.RateLimiting/src/System.Threading.RateLimiting.csproj

index a4ffedf6d790cafa416408382d37fcebec801d8e..fe4c60862798ba37d193890548e9ab4987282f45 100644 (file)
   </Target>
 
   <PropertyGroup Condition="'$(UseIntellisensePackageDocXmlFile)' == 'true'">
-    <NoWarn>$(NoWarn);1591</NoWarn>
     <IntellisensePackageXmlRootFolder>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.private.intellisense', '$(MicrosoftPrivateIntellisenseVersion)', 'IntellisenseFiles'))</IntellisensePackageXmlRootFolder>
     <IntellisensePackageXmlFilePathFromNetFolder>$([MSBuild]::NormalizePath('$(IntellisensePackageXmlRootFolder)', 'net', '1033', '$(AssemblyName).xml'))</IntellisensePackageXmlFilePathFromNetFolder>
     <IntellisensePackageXmlFilePathFromDotNetPlatExtFolder>$([MSBuild]::NormalizePath('$(IntellisensePackageXmlRootFolder)', 'dotnet-plat-ext', '1033', '$(AssemblyName).xml'))</IntellisensePackageXmlFilePathFromDotNetPlatExtFolder>
     <IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromNetFolder))">$(IntellisensePackageXmlFilePathFromNetFolder)</IntellisensePackageXmlFilePath>
     <IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder))">$(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder)</IntellisensePackageXmlFilePath>
+    <!-- Suppress "CS1591 - Missing XML comment for publicly visible type or member" compiler errors if
+         - the intellisense package xml file is used or
+         - the assembly is private (i.e. System.Private.Uri) or
+         - the assembly is a PNSE assembly. -->
+    <NoWarn Condition="'$(IntellisensePackageXmlFilePath)' != '' or
+                       '$(IsPrivateAssembly)' == 'true' or
+                       '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(NoWarn);1591</NoWarn>
   </PropertyGroup>
 
   <ItemGroup>
index 313bc2ab4868d64ee0000d758233e03f92b59d61..43af9e134a2136034f42173d312de668e2c85618 100644 (file)
@@ -1,6 +1,8 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);netstandard2.1</TargetFrameworks>
+    <!-- Public API not fully documented. -->
+    <NoWarn>$(NoWarn);1591</NoWarn>
     <IsPackable>true</IsPackable>
     <!-- This assembly should never be placed inbox as it is only for downlevel compatibility. -->
     <PackageDescription>Provides the IAsyncEnumerable&lt;T&gt; and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.
index 8a167e3eab12834da4131d178fbd2ced5bd14ba4..af88313e6c1308544eee5bb4d10d3204d8cdb532 100644 (file)
@@ -9,6 +9,8 @@
     <IsTrimmable>false</IsTrimmable>
     <EnableAOTAnalyzer>false</EnableAOTAnalyzer>
     <NoWarn>$(NoWarn);CA1852</NoWarn>
+    <!-- Public API not fully documented. -->
+    <NoWarn>$(NoWarn);1591</NoWarn>
     <IsPackable>true</IsPackable>
     <PackageDescription>Suite of xUnit.net tests to check for container compatibility with Microsoft.Extensions.DependencyInjection.</PackageDescription>
     <!-- this assembly doesn't need to be binplaced -->
index 4069eee62b84f0dc137cd18e7133c3b115a74c55..f14fb7a69588b7190be3d41b079541156feb6618 100644 (file)
@@ -21,7 +21,9 @@ namespace Microsoft.Extensions.Hosting.Systemd
         /// <summary>
         /// Check if the current process is hosted as a systemd Service.
         /// </summary>
-        /// <returns><c>True</c> if the current process is hosted as a systemd Service, otherwise <c>false</c>.</returns>
+        /// <returns>
+        /// <see langword="true" /> if the current process is hosted as a systemd Service; otherwise, <see langword="false" />.
+        /// </returns>
         public static bool IsSystemdService()
             => _isSystemdService ??= GetIsSystemdService();
 
index e1b196fb2a6f5d727eb534f975edbca6a4f152af..94addfe256f9d79b5c3865e73a718fc6064eb79d 100644 (file)
@@ -46,11 +46,29 @@ namespace Microsoft.Extensions.Hosting.Systemd
         private ILogger Logger { get; }
         private ISystemdNotifier SystemdNotifier { get; }
 
+        /// <summary>
+        /// Asynchronously stops and shuts down the host. This method is called from <see cref="IHost.StopAsync(CancellationToken)" />.
+        /// </summary>
+        /// <param name="cancellationToken">
+        /// A cancellation token that indicates when stop should no longer be graceful.
+        /// </param>
+        /// <returns>
+        /// A task that represents the asynchronous stop operation.
+        /// </returns>
         public Task StopAsync(CancellationToken cancellationToken)
         {
             return Task.CompletedTask;
         }
 
+        /// <summary>
+        /// Asynchronously waits until the start operation is complete before continuing. This method is called at the beginning of <see cref="IHost.StartAsync(CancellationToken)" />. This can be used to delay startup until signaled by an external event.
+        /// </summary>
+        /// <param name="cancellationToken">
+        /// A cancellation token that indicates when stop should no longer be graceful.
+        /// </param>
+        /// <returns>
+        /// A task that represents the waiting for start operation.
+        /// </returns>
         public Task WaitForStartAsync(CancellationToken cancellationToken)
         {
             _applicationStartedRegistration = ApplicationLifetime.ApplicationStarted.Register(state =>
@@ -86,6 +104,9 @@ namespace Microsoft.Extensions.Hosting.Systemd
             SystemdNotifier.Notify(ServiceState.Stopping);
         }
 
+        /// <summary>
+        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+        /// </summary>
         public void Dispose()
         {
             UnregisterShutdownHandlers();
index bfde5fe73df6a5945f2f8ef6f8be5ef86b91de8b..2bc1865423f88ecbd1cc72dbee26ab9eea5b16aa 100644 (file)
@@ -7,6 +7,9 @@ using System.Runtime.Versioning;
 
 namespace Microsoft.Extensions.Hosting.Systemd
 {
+    /// <summary>
+    /// Provides support to notify systemd about the service status.
+    /// </summary>
     [UnsupportedOSPlatform("browser")]
     public class SystemdNotifier : ISystemdNotifier
     {
index 883be7b40f2d1a758bc2125bbd704d4ecdc2c706..1f182bc223d1417943ad3a477ffff8ba2ebf78fb 100644 (file)
@@ -15,7 +15,9 @@ namespace Microsoft.Extensions.Hosting.WindowsServices
         /// <summary>
         /// Check if the current process is hosted as a Windows Service.
         /// </summary>
-        /// <returns><c>True</c> if the current process is hosted as a Windows Service, otherwise <c>false</c>.</returns>
+        /// <returns>
+        /// <see langword="true" /> if the current process is hosted as a Windows Service; otherwise, <see langword="false" />.
+        /// </returns>
         [SupportedOSPlatformGuard("windows")]
         public static bool IsWindowsService()
         {
index 7edd3ea3d35c32bbdd181a3cbe3469eafe3bdfe8..69e0fd1a06731c66b672a6e757715bb9e342c358 100644 (file)
@@ -62,6 +62,15 @@ namespace Microsoft.Extensions.Hosting.WindowsServices
         private IHostEnvironment Environment { get; }
         private ILogger Logger { get; }
 
+        /// <summary>
+        /// Asynchronously waits until start is complete before continuing. This method is called at the beginning of <see cref="IHost.StartAsync(CancellationToken)" />. This can be used to delay startup until signaled by an external event.
+        /// </summary>
+        /// <param name="cancellationToken">
+        /// A cancellation token that indicates when stop should no longer be graceful.
+        /// </param>
+        /// <returns>
+        /// A task that represents the asynchronous waiting for start operation.
+        /// </returns>
         public Task WaitForStartAsync(CancellationToken cancellationToken)
         {
             cancellationToken.Register(() => _delayStart.TrySetCanceled());
@@ -99,9 +108,14 @@ namespace Microsoft.Extensions.Hosting.WindowsServices
         }
 
         /// <summary>
-        /// Called from <see cref="IHost.StopAsync"/> to stop the service if not already stopped, and wait for the service dispatcher to exit.
-        /// Once this method returns the service is stopped and the process can be terminated at any time.
+        /// Asynchronously stops and shuts down the host. This method is called from <see cref="IHost.StopAsync(CancellationToken)" />.
         /// </summary>
+        /// <param name="cancellationToken">
+        /// A cancellation token that indicates when stop should no longer be graceful.
+        /// </param>
+        /// <returns>
+        /// A task that represents the asynchronous stop operation.
+        /// </returns>
         public async Task StopAsync(CancellationToken cancellationToken)
         {
             cancellationToken.ThrowIfCancellationRequested();
index 53a8dc0eb480745bf80e27adfa291361cce2681e..c1858dbe0c7fbd408db4b713ab8c2d058a19a90e 100644 (file)
@@ -5,6 +5,9 @@ using Microsoft.Extensions.Hosting;
 
 namespace Microsoft.Extensions.Hosting
 {
+    /// <summary>
+    /// Options to configure the lifetime of a windows service.
+    /// </summary>
     public class WindowsServiceLifetimeOptions
     {
         /// <summary>
index 1df89338842fdac84c853acbfe3aadd9f60ee91e..1b22030ff3d967317e1b684f1e3ff05324fd06d8 100644 (file)
@@ -1,13 +1,16 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppToolCurrent);$(NetFrameworkToolCurrent)</TargetFrameworks>
+    <AssemblyName>Microsoft.NETCore.Platforms.BuildTasks</AssemblyName>
+
+    <!-- Opt out of features that aren't necessary for a local build task. -->
     <Nullable>disable</Nullable>
     <EnableBinPlacing>false</EnableBinPlacing>
     <!-- This project should not build against the live built .NETCoreApp targeting pack as it contributes to the build itself. -->
     <UseLocalTargetingRuntimePack>false</UseLocalTargetingRuntimePack>
-    <AssemblyName>Microsoft.NETCore.Platforms.BuildTasks</AssemblyName>
     <IncludeBuildOutput>false</IncludeBuildOutput>
     <IncludeSymbols>false</IncludeSymbols>
+    <GenerateDocumentationFile>false</GenerateDocumentationFile>
 
     <IsPackable>true</IsPackable>
     <PackageId>$(MSBuildProjectName)</PackageId>
index 50559202a984e045b70ef0afe57d552143bb2b5e..521f8055a4fa61c54028eb301d73e3b4345619f1 100644 (file)
@@ -2,6 +2,8 @@
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <!-- Public API not fully documented. -->
+    <NoWarn>$(NoWarn);1591</NoWarn>
     <IsPackable>true</IsPackable>
     <PackageDescription>Tensor class which represents and extends multi-dimensional arrays.
 
index 128a12cf6048a539e377b88ce1688a7ef656f8ef..a06ca783311a3b14cb91c6405ff5acbf10d22e88 100644 (file)
@@ -7,6 +7,8 @@
     <NoWarn>$(NoWarn);CS0649;SA1129;IDE0059;IDE0060;CA1822;CA1852</NoWarn>
     <Nullable>annotations</Nullable>
     <IsTrimmable>false</IsTrimmable>
+    <!-- Public API not fully documented. -->
+    <NoWarn>$(NoWarn);1591</NoWarn>
     <IsPackable>true</IsPackable>
     <AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>
     <AddNETFrameworkAssemblyReferenceToPackage>true</AddNETFrameworkAssemblyReferenceToPackage>
index d1400f97ec8b666a26747d6390eb63cd1ba9c549..00c1eadc2486b9affd6d37e77a4931f8e47bc1ef 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
     <IsPackable>true</IsPackable>