From cb913a66410d4b848fa391049313e2b27f0346ae Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Thu, 16 May 2024 14:06:43 -0400 Subject: [PATCH 1/2] Add "nullable" value for warnings as errors Fixes #40355 I also checked other files deleted in #22797 and nothing else was lost. --- .../compiler-options/errors-warnings.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/csharp/language-reference/compiler-options/errors-warnings.md b/docs/csharp/language-reference/compiler-options/errors-warnings.md index aa06eaf214b8b..4af2071c50db4 100644 --- a/docs/csharp/language-reference/compiler-options/errors-warnings.md +++ b/docs/csharp/language-reference/compiler-options/errors-warnings.md @@ -87,25 +87,25 @@ All warning messages are instead reported as errors. The build process halts (no ## WarningsAsErrors and WarningsNotAsErrors -The **WarningsAsErrors** and **WarningsNotAsErrors** options override the **TreatWarningsAsErrors** option for a list of warnings. This option can be used with all *CS* warnings. The "CS" prefix is optional. You can use either the number, or "CS" followed by the error or warning number. For other elements that affect warnings, see the [Common MSBuild properties](/visualstudio/msbuild/common-msbuild-project-properties). +The **WarningsAsErrors** and **WarningsNotAsErrors** options override the **TreatWarningsAsErrors** option for a list of warnings. This option can be used with all *CS* warnings. The "CS" prefix is optional. You can use either the number, or "CS" followed by the error or warning number. For other elements that affect warnings, see the [Common MSBuild properties](/visualstudio/msbuild/common-msbuild-project-properties). In addition to the list of warning IDs, the string `nullable` treats all warnings related to nullability as errors. -Enable warnings 0219 and 0168 as errors: +Enable warnings 0219, 0168, and all nullable warnings as errors: ```xml -0219,CS0168 +0219,CS0168,nullable ``` Disable the same warnings as errors: ```xml -0219,CS0168 +0219,CS0168,nullable ``` You use **WarningsAsErrors** to configure a set of warnings as errors. Use **WarningsNotAsErrors** to configure a set of warnings that should not be errors when you've set all warnings as errors. ## NoWarn -The **NoWarn** option lets you suppress the compiler from displaying one or more warnings, where `warningnumber1`, `warningnumber2` are warning numbers that you want the compiler to suppress. Separate multiple warning numbers with a comma. +The **NoWarn** option lets you suppress the compiler from displaying one or more warnings, where `warningnumber1`, `warningnumber2` are warning numbers that you want the compiler to suppress. Separate multiple warning numbers with a comma. You can use `nullable` to disable all warnings related to nullability. ```xml warningnumber1,warningnumber2 From 2aceef300818137d38ff2d5a36d693045abab90f Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Mon, 20 May 2024 10:34:33 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../language-reference/compiler-options/errors-warnings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csharp/language-reference/compiler-options/errors-warnings.md b/docs/csharp/language-reference/compiler-options/errors-warnings.md index 4af2071c50db4..73b8c5489b323 100644 --- a/docs/csharp/language-reference/compiler-options/errors-warnings.md +++ b/docs/csharp/language-reference/compiler-options/errors-warnings.md @@ -87,7 +87,7 @@ All warning messages are instead reported as errors. The build process halts (no ## WarningsAsErrors and WarningsNotAsErrors -The **WarningsAsErrors** and **WarningsNotAsErrors** options override the **TreatWarningsAsErrors** option for a list of warnings. This option can be used with all *CS* warnings. The "CS" prefix is optional. You can use either the number, or "CS" followed by the error or warning number. For other elements that affect warnings, see the [Common MSBuild properties](/visualstudio/msbuild/common-msbuild-project-properties). In addition to the list of warning IDs, the string `nullable` treats all warnings related to nullability as errors. +The **WarningsAsErrors** and **WarningsNotAsErrors** options override the **TreatWarningsAsErrors** option for a list of warnings. This option can be used with all *CS* warnings. The "CS" prefix is optional. You can use either the number, or "CS" followed by the error or warning number. For other elements that affect warnings, see the [Common MSBuild properties](/visualstudio/msbuild/common-msbuild-project-properties). In addition to the list of warning IDs, you can also specify the string `nullable`, which treats all warnings related to nullability as errors. Enable warnings 0219, 0168, and all nullable warnings as errors: @@ -105,7 +105,7 @@ You use **WarningsAsErrors** to configure a set of warnings as errors. Use **War ## NoWarn -The **NoWarn** option lets you suppress the compiler from displaying one or more warnings, where `warningnumber1`, `warningnumber2` are warning numbers that you want the compiler to suppress. Separate multiple warning numbers with a comma. You can use `nullable` to disable all warnings related to nullability. +The **NoWarn** option lets you suppress the compiler from displaying one or more warnings, where `warningnumber1`, `warningnumber2` are warning numbers that you want the compiler to suppress. Separate multiple warning numbers with a comma. You can specify `nullable` to disable all warnings related to nullability. ```xml warningnumber1,warningnumber2