Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/list-of-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |

Original file line number Diff line number Diff line change
@@ -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 |
---
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Compile Include="..\..\System.Windows.Forms.Analyzers\src\System\Windows\Forms\AnalyzerConfigOptionsProviderExtensions.cs" Link="System\Windows\Forms\AnalyzerConfigOptionsProviderExtensions.cs" />
<Compile Include="..\..\System.Windows.Forms.Primitives\src\System\Windows\Forms\HighDpiMode.cs" Link="System\Windows\Forms\HighDpiMode.cs" />
<None Include="..\..\..\pkg\Microsoft.Private.Winforms\sdk\dotnet-wpf\System.Windows.Forms.Analyzers.props" Link="System.Windows.Forms.Analyzers.props" />
<None Include="..\ApplicationConfigurationGenerator.Help.md" Link="ApplicationConfigurationGenerator.Help.md" />
</ItemGroup>

<ItemGroup>
Expand Down
21 changes: 20 additions & 1 deletion src/System.Windows.Forms.Analyzers/AppManifestAnalyzer.Help.md
Original file line number Diff line number Diff line change
@@ -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 |
---
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<Compile Include="..\..\System.Windows.Forms.Primitives\src\System\Windows\Forms\HighDpiMode.cs" Link="System\Windows\Forms\HighDpiMode.cs" />
<None Include="..\..\..\pkg\Microsoft.Private.Winforms\sdk\dotnet-wpf\System.Windows.Forms.Analyzers.props" Link="System.Windows.Forms.Analyzers.props" />
<None Include="..\AppManifestAnalyzer.Help.md" Link="AppManifestAnalyzer.Help.md" />
</ItemGroup>

<ItemGroup>
Expand All @@ -20,8 +21,8 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisCSharpWorkspacesVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="$(MicrosoftCodeAnalysisVisualBasicWorkspacesVersion)" />

<AdditionalFiles Include="$(ProjectDir)AnalyzerReleases.Unshipped.txt" />
<AdditionalFiles Include="$(ProjectDir)AnalyzerReleases.Shipped.txt" />
<AdditionalFiles Include="$(ProjectDir)AnalyzerReleases.Unshipped.md" />
<AdditionalFiles Include="$(ProjectDir)AnalyzerReleases.Shipped.md" />
</ItemGroup>

<ItemGroup>
Expand Down