From 4cc1c8c7cc30f95c87ddde63bcc562f67f8557ea Mon Sep 17 00:00:00 2001 From: Igor Velikorossov Date: Wed, 10 Aug 2022 17:36:20 +1000 Subject: [PATCH] Add analyzer diagnostics docs Resolves #5378 --- docs/list-of-diagnostics.md | 13 +++++ .../ApplicationConfigurationGenerator.Help.md | 47 ++++++++++++++++++- ...stem.Windows.Forms.Analyzers.CSharp.csproj | 1 + .../AppManifestAnalyzer.Help.md | 21 ++++++++- .../src/System.Windows.Forms.Analyzers.csproj | 5 +- 5 files changed, 83 insertions(+), 4 deletions(-) diff --git a/docs/list-of-diagnostics.md b/docs/list-of-diagnostics.md index 239dc60ad39..07382fead93 100644 --- a/docs/list-of-diagnostics.md +++ b/docs/list-of-diagnostics.md @@ -39,3 +39,16 @@ The acceptance criteria for adding an obsoletion includes: | __`WFDEV002`__ | `DomainUpDown.DomainUpDownAccessibleObject` is no longer used to provide accessible support for `DomainUpDown` controls. | | __`WFDEV003`__ | `DomainUpDown.DomainItemAccessibleObject` is no longer used to provide accessible support for `DomainUpDown` items. | + +## Analyzer Warnings + +The diagnostic id values reserved for Windows Forms .NET analyzer warnings are WF??001 through WF??999. + +### Analyzer Diagnostics (`WF??001` - `WF??999`) + +| Diagnostic ID | Description | +| :---------------- | :---------- | +| __`WFAC001`__ | Unsupported project type. | +| __`WFAC002`__ | Unsupported property value. | +| __`WFAC010`__ | Unsupported high DPI configuration. | + diff --git a/src/System.Windows.Forms.Analyzers.CSharp/ApplicationConfigurationGenerator.Help.md b/src/System.Windows.Forms.Analyzers.CSharp/ApplicationConfigurationGenerator.Help.md index 26ba76cdb31..235896d2ed6 100644 --- a/src/System.Windows.Forms.Analyzers.CSharp/ApplicationConfigurationGenerator.Help.md +++ b/src/System.Windows.Forms.Analyzers.CSharp/ApplicationConfigurationGenerator.Help.md @@ -1 +1,46 @@ -# How to use ApplicationConfigurationGenerator +# How to use System.Windows.Forms.Analyzers.CSharp + +System.Windows.Forms.Analyzers.CSharp analyzers and source generators are shipped inbox with Windows Desktop .NET SDK, and +are automatically referenced for Window Forms .NET applications. + +## `ApplicationConfigurationGenerator` + +`ApplicationConfigurationGenerator` is automatically invoked when `ApplicationConfiguration.Initialize()` call is detected, +and it emits the application bootstrap code such as: +```cs +public static void Initialize() +{ + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.SetHighDpiMode(HighDpiMode.SystemAware); +} +``` + +For more information on application configuration refer to https://aka.ms/applicationconfiguration. + + +## [WFAC001](https://aka.ms/winforms-warnings/WFAC001): Unsupported project type. + +Only projects with `OutputType` set to "Exe" or "WinExe" are supported, because only applications projects define an application entry point, +where the application bootstrap code must reside. + +|Item|Value| +|-|-| +| Category | ApplicationConfiguration | +| Enabled | True | +| Severity | Error | +| CodeFix | False | +--- + + +## [WFAC002](https://aka.ms/winforms-warnings/WFAC002): Unsupported property value. + +The specified project property cannot be set to the given value. + +|Item|Value| +|-|-| +| Category | ApplicationConfiguration | +| Enabled | True | +| Severity | Error | +| CodeFix | False | +--- \ No newline at end of file diff --git a/src/System.Windows.Forms.Analyzers.CSharp/src/System.Windows.Forms.Analyzers.CSharp.csproj b/src/System.Windows.Forms.Analyzers.CSharp/src/System.Windows.Forms.Analyzers.CSharp.csproj index 2c03372b283..4d964e75cfe 100644 --- a/src/System.Windows.Forms.Analyzers.CSharp/src/System.Windows.Forms.Analyzers.CSharp.csproj +++ b/src/System.Windows.Forms.Analyzers.CSharp/src/System.Windows.Forms.Analyzers.CSharp.csproj @@ -16,6 +16,7 @@ + diff --git a/src/System.Windows.Forms.Analyzers/AppManifestAnalyzer.Help.md b/src/System.Windows.Forms.Analyzers/AppManifestAnalyzer.Help.md index f80ac6db3fc..e051c99b6ff 100644 --- a/src/System.Windows.Forms.Analyzers/AppManifestAnalyzer.Help.md +++ b/src/System.Windows.Forms.Analyzers/AppManifestAnalyzer.Help.md @@ -1,2 +1,21 @@ -# How to use AppManifestAnalyzer +# How to use System.Windows.Forms.Analyzers +System.Windows.Forms.Analyzers analyzers and source generators are shipped inbox with Windows Desktop .NET SDK, and +are automatically referenced for Window Forms .NET applications. + +## `AppManifestAnalyzer` + +`AppManifestAnalyzer` is automatically invoked when a Windows Forms application (`OutputType=Exe` or `OutputType=WinExe`) has a custom app.manifest. + +## [WFAC010](https://aka.ms/winforms-warnings/WFAC010): Unsupported high DPI configuration. + +Windows Forms applications should specify application DPI-awareness via the [application configuration](https://aka.ms/applicationconfiguration) or +[`Application.SetHighDpiMode` API](https://docs.microsoft.com/dotnet/api/system.windows.forms.application.sethighdpimode). + +|Item|Value| +|-|-| +| Category | ApplicationConfiguration | +| Enabled | True | +| Severity | Warning | +| CodeFix | False | +--- diff --git a/src/System.Windows.Forms.Analyzers/src/System.Windows.Forms.Analyzers.csproj b/src/System.Windows.Forms.Analyzers/src/System.Windows.Forms.Analyzers.csproj index a60ab434b58..2201d0bb4d2 100644 --- a/src/System.Windows.Forms.Analyzers/src/System.Windows.Forms.Analyzers.csproj +++ b/src/System.Windows.Forms.Analyzers/src/System.Windows.Forms.Analyzers.csproj @@ -10,6 +10,7 @@ + @@ -20,8 +21,8 @@ - - + +