Skip to content

Commit eaaf38c

Browse files
Documentation updates for compiler warnings.
We had published documentation for analyzers shipped in NET9 - https://learn.microsoft.com/en-us/dotnet/desktop/winforms/compiler-messages/wfo0002?view=netdesktop-9.0 list-of-diagnostics file contains full list of the compiler warnings and errors, obsoletions, experimental features and diagnostics reported by our analyzers. This will help picking up the next number when adding a new ID. I also added notes on the updated documentation steps. Our local analyzer help files are duplicating information from the "learn" site, but they are useful for analyzers that are shipped in preview and not yet documented. I updated these files with newer links, added missing analyzer and removed one that was duplicated in 3 files, assuming that the "learn" site is the main source of information for the users. One of the analyzer error messages is updated to follow the common format - emphasize API name with ticks. Removed unused diagnostic ID Updated AnalyzerReleases files with correst history of when they were shipped and the newly published documentation links
1 parent 99e6751 commit eaaf38c

File tree

25 files changed

+260
-207
lines changed

25 files changed

+260
-207
lines changed

docs/analyzers/AppManifestAnalyzer.Help.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ are automatically referenced for Window Forms .NET applications.
77

88
`AppManifestAnalyzer` is automatically invoked when a Windows Forms application (`OutputType=Exe` or `OutputType=WinExe`) has a custom app.manifest.
99

10-
## [WFO0003](https://aka.ms/winforms-warnings/WFAC010): Unsupported high DPI configuration.
10+
## [WFO0003](https://learn.microsoft.com/dotnet/desktop/winforms/compiler-messages/wfo0003): Unsupported high DPI configuration.
1111

1212
Windows Forms applications should specify application DPI-awareness via the [application configuration](https://aka.ms/applicationconfiguration) or
1313
[`Application.SetHighDpiMode` API](https://docs.microsoft.com/dotnet/api/system.windows.forms.application.sethighdpimode).
1414

15-
|Item|Value|
16-
|-|-|
17-
| Category | ApplicationConfiguration |
18-
| Enabled | True |
19-
| Severity | Warning |
20-
| CodeFix | False |
15+
In NET6.0 the same warning was shipped with ID `WFAC010`.
16+
17+
| Item | Value |
18+
|-----------|--------------------------|
19+
| Category | ApplicationConfiguration |
20+
| Enabled | True |
21+
| Severity | Warning |
22+
| CodeFix | False |
23+
| Changed in| NET9.0 |
24+
2125
---

docs/analyzers/ApplicationConfigurationGenerator.Help.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,34 @@ public static void Initialize()
1818

1919
For more information on application configuration refer to https://aka.ms/applicationconfiguration.
2020

21-
22-
## [WFO0001](https://aka.ms/winforms-warnings/WFAC001): Unsupported project type.
21+
## [WFO0001](https://learn.microsoft.com/dotnet/desktop/winforms/compiler-messages/wfo0001): Unsupported project type.
2322

2423
Only projects with `OutputType` set to "Exe" or "WinExe" are supported, because only applications projects define an application entry point,
2524
where the application bootstrap code must reside.
2625

27-
|Item|Value|
28-
|-|-|
29-
| Category | ApplicationConfiguration |
30-
| Enabled | True |
31-
| Severity | Error |
32-
| CodeFix | False |
33-
---
26+
In NET6.0 the same error was shipped with ID `WFAC001`.
3427

28+
| Item | Value |
29+
|-----------|----------------------------|
30+
| Category | ApplicationConfiguration |
31+
| Enabled | True |
32+
| Severity | Error |
33+
| CodeFix | False |
34+
| Changed in| NET9.0 |
3535

36-
## [WFO0002](https://aka.ms/winforms-warnings/WFAC002): Unsupported property value.
36+
---
37+
38+
## [WFO0002](https://learn.microsoft.com/dotnet/desktop/winforms/compiler-messages/wfo0002): Unsupported property value.
3739

3840
The specified project property cannot be set to the given value.
41+
In NET6.0 the same error was shipped with ID `WFAC002`.
42+
43+
| Item | Value |
44+
|-----------|----------------------------|
45+
| Category | ApplicationConfiguration |
46+
| Enabled | True |
47+
| Severity | Error |
48+
| CodeFix | False |
49+
| Changed in| NET9.0 |
3950

40-
|Item|Value|
41-
|-|-|
42-
| Category | ApplicationConfiguration |
43-
| Enabled | True |
44-
| Severity | Error |
45-
| CodeFix | False |
4651
---

docs/analyzers/WinFormsCSharpAnalyzers.Help.md

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,58 @@
33
System.Windows.Forms.Analyzers analyzers and source generators are shipped inbox with Windows Desktop .NET SDK, and
44
are automatically referenced for Window Forms .NET applications.
55

6-
## `AppManifestAnalyzer`
6+
## `MissingPropertySerializationConfiguration`
77

8-
`AppManifestAnalyzer` is automatically invoked when a Windows Forms application (`OutputType=Exe` or `OutputType=WinExe`) has a custom app.manifest.
8+
`MissingPropertySerializationConfiguration` checks for missing `DesignerSerializationVisibilityAttribute` on properties of classes which are
9+
derived from `Control` and could potentially serialize design-time data by the designer without the user being aware of it.
910

10-
### [WFO0003](https://aka.ms/winforms-warnings/WFAC010): Unsupported high DPI configuration.
11+
### [WFO1000](https://learn.microsoft.com/dotnet/desktop/winforms/compiler-messages/wfo1000): Missing property serialization configuration.
1112

12-
Windows Forms applications should specify application DPI-awareness via the [application configuration](https://aka.ms/applicationconfiguration) or
13-
[`Application.SetHighDpiMode` API](https://docs.microsoft.com/dotnet/api/system.windows.forms.application.sethighdpimode).
13+
Properties of classes derived from `Control` should have `DesignerSerializationVisibilityAttribute`
14+
set to `DesignerSerializationVisibility.Content` or `DesignerSerializationVisibility.Visible`.
15+
16+
| Item | Value |
17+
|-----------|------------------|
18+
| Category | WinForms Security|
19+
| Enabled | True |
20+
| Severity | Error |
21+
| CodeFix | False |
22+
| Added in | NET9.0 |
1423

15-
|Item|Value|
16-
|-|-|
17-
| Category | ApplicationConfiguration |
18-
| Enabled | True |
19-
| Severity | Warning |
20-
| CodeFix | False |
2124
---
2225

23-
## `MissingPropertySerializationConfiguration`
26+
## `AvoidPassingFuncReturningTaskWithoutCancellationToken`
2427

25-
`MissingPropertySerializationConfiguration` checks for missing `DesignerSerializationVisibilityAttribute` on properties of classes which are
26-
derived from `Control` and could potentially serialize design-time data by the designer without the user being aware of it.
28+
`AvoidPassingFuncReturningTaskWithoutCancellationToken` checks parameters passed to `Control.InvokeAsync`. It suggests to use a cancellation token when passing a task to these methods.
2729

28-
### [WFO1000](https://aka.ms/winforms-warnings/WFO1000): Missing property serialization configuration.
30+
### [WFO2001](https://learn.microsoft.com/dotnet/desktop/winforms/compiler-messages/wfo2001): Task is being passed to InvokeAsync without a cancellation token.
2931

30-
Properties of classes derived from `Control` should have `DesignerSerializationVisibilityAttribute`
31-
set to `DesignerSerializationVisibility.Content` or `DesignerSerializationVisibility.Visible`.
32+
Avoid passing a `Func<T>` to `InvokeAsync` where `T` is a `Task` or `ValueTask`, unless your intention is for the delegate to simply be kicked off as an unsupervised task. Instead, use `Func<CancellationToken, ValueTask>` or `Func<CancellationToken, ValueTask<T>>`, so that the delegate passed to `InvokeAsync` can be awaited, allowing exceptions to be properly handled.
33+
34+
| Item | Value |
35+
|-----------|------------------|
36+
| Category | WinForms Usage |
37+
| Enabled | True |
38+
| Severity | Warning |
39+
| CodeFix | False |
40+
| Added in | NET9.0 |
3241

33-
|Item|Value|
34-
|-|-|
35-
| Category | WinForms Security |
36-
| Enabled | True |
37-
| Severity | Warning |
38-
| CodeFix | False |
3942
---
4043

4144
## `ImplementITypedDataObject`
4245

4346
`ImplementITypedDataObject` checks custom implementations of the managed `IDataObject` interface and suggests to also implement the `ITypedDataObject` interface.
4447

45-
### [WFO1001](https://aka.ms/winforms-warnings/WFO1001): `IDataObject` type does not implement `ITypedDataObject`.
48+
### [WFO1001](https://github.com/dotnet/winforms/blob/main/docs/analyzers/WinFormsCSharpAnalyzers.Help.md#implementitypeddataobject): `IDataObject` type does not implement `ITypedDataObject`.
4649

4750
Types should implement `ITypedDataObject` to support best practices when interacting with data. Types will not work with typed APIs in Clipboard and other data exchange scenarios if they only implement `IDataObject`.
4851

49-
|Item|Value|
50-
|-|-|
51-
| Category | WinForms Security |
52-
| Enabled | True |
53-
| Severity | Warning |
54-
| CodeFix | False |
52+
| Item | Value |
53+
|-----------|------------------|
54+
| Category | WinForms Security|
55+
| Enabled | True |
56+
| Severity | Warning |
57+
| CodeFix | False |
58+
| Added in | NET10.0 |
59+
5560
---

docs/analyzers/WinFormsVisualBasicAnalyzers.Help.md

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,58 @@
33
System.Windows.Forms.Analyzers analyzers and source generators are shipped inbox with Windows Desktop .NET SDK, and
44
are automatically referenced for Window Forms .NET applications.
55

6-
## `AppManifestAnalyzer`
6+
## `MissingPropertySerializationConfiguration`
77

8-
`AppManifestAnalyzer` is automatically invoked when a Windows Forms application (`OutputType=Exe` or `OutputType=WinExe`) has a custom app.manifest.
8+
`MissingPropertySerializationConfiguration` checks for missing `DesignerSerializationVisibilityAttribute` on properties of classes which are
9+
derived from `Control` and could potentially serialize design-time data by the designer without the user being aware of it.
910

10-
### [WFO0003](https://aka.ms/winforms-warnings/WFAC010): Unsupported high DPI configuration.
11+
### [WFO1000](https://learn.microsoft.com/dotnet/desktop/winforms/compiler-messages/wfo1000): Missing property serialization configuration.
1112

12-
Windows Forms applications should specify application DPI-awareness via the [application configuration](https://aka.ms/applicationconfiguration) or
13-
[`Application.SetHighDpiMode` API](https://docs.microsoft.com/dotnet/api/system.windows.forms.application.sethighdpimode).
13+
Properties of classes derived from `Control` should have `DesignerSerializationVisibilityAttribute`
14+
set to `DesignerSerializationVisibility.Content` or `DesignerSerializationVisibility.Visible`.
15+
16+
| Item | Value |
17+
|-----------|------------------|
18+
| Category | WinForms Security|
19+
| Enabled | True |
20+
| Severity | Error |
21+
| CodeFix | False |
22+
| Added in | NET9.0 |
1423

15-
|Item|Value|
16-
|-|-|
17-
| Category | ApplicationConfiguration |
18-
| Enabled | True |
19-
| Severity | Warning |
20-
| CodeFix | False |
2124
---
2225

23-
## `MissingPropertySerializationConfiguration`
26+
## `AvoidPassingFuncReturningTaskWithoutCancellationToken`
2427

25-
`MissingPropertySerializationConfiguration` checks for missing `DesignerSerializationVisibilityAttribute` on properties of classes which are
26-
derived from `Control` and could potentially serialize design-time data by the designer without the user being aware of it.
28+
`AvoidPassingFuncReturningTaskWithoutCancellationToken` checks parameters passed to `Control.InvokeAsync`. It suggests to use a cancellation token when passing a task to these methods.
2729

28-
### [WFO1000](https://aka.ms/winforms-warnings/WFO1000): Missing property serialization configuration.
30+
### [WFO2001](https://learn.microsoft.com/dotnet/desktop/winforms/compiler-messages/wfo2001): Task is being passed to InvokeAsync without a cancellation token.
2931

30-
Properties of classes derived from `Control` should have `DesignerSerializationVisibilityAttribute`
31-
set to `DesignerSerializationVisibility.Content` or `DesignerSerializationVisibility.Visible`.
32+
Avoid passing a `Func<T>` to `InvokeAsync` where `T` is a `Task` or `ValueTask`, unless your intention is for the delegate to simply be kicked off as an unsupervised task. Instead, use `Func<CancellationToken, ValueTask>` or `Func<CancellationToken, ValueTask<T>>`, so that the delegate passed to `InvokeAsync` can be awaited, allowing exceptions to be properly handled.
33+
34+
| Item | Value |
35+
|-----------|------------------|
36+
| Category | WinForms Usage |
37+
| Enabled | True |
38+
| Severity | Warning |
39+
| CodeFix | False |
40+
| Added in | NET9.0 |
3241

33-
|Item|Value|
34-
|-|-|
35-
| Category | WinForms Security |
36-
| Enabled | True |
37-
| Severity | Warning |
38-
| CodeFix | False |
3942
---
4043

4144
## `ImplementITypedDataObject`
4245

4346
`ImplementITypedDataObject` checks custom implementations of the managed `IDataObject` interface and suggests to also implement the `ITypedDataObject` interface.
4447

45-
### [WFO1001](https://aka.ms/winforms-warnings/WFO1001): `IDataObject` type does not implement `ITypedDataObject`.
48+
### [WFO1001](https://github.com/dotnet/winforms/blob/main/docs/analyzers/WinFormsCSharpAnalyzers.Help.md#implementitypeddataobject): `IDataObject` type does not implement `ITypedDataObject`.
4649

4750
Types should implement `ITypedDataObject` to support best practices when interacting with data. Types will not work with typed APIs in Clipboard and other data exchange scenarios if they only implement `IDataObject`.
4851

49-
|Item|Value|
50-
|-|-|
51-
| Category | WinForms Security |
52-
| Enabled | True |
53-
| Severity | Warning |
54-
| CodeFix | False |
52+
| Item | Value |
53+
|-----------|------------------|
54+
| Category | WinForms Security|
55+
| Enabled | True |
56+
| Severity | Warning |
57+
| CodeFix | False |
58+
| Added in | NET10.0 |
59+
5560
---

docs/analyzers/akams.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## These mappings are defined in the [redirection manager](https://akalinkmanager.trafficmanager.net/am/redirection/home?options=host:aka.ms)
2+
3+
| Short URL | Full URL |
4+
|--------------------------------|------------------------------------------------------------------------------------------------|
5+
| https://aka.ms/WfoGenManifest | https://github.com/dotnet/winforms/blob/main/docs/analyzers/AppManifestAnalyzer.Help.md |
6+
| https://aka.ms/WfoExperimental | https://github.com/dotnet/winforms/blob/main/docs/analyzers/Experimental.Help.md |
7+
| https://aka.ms/WfoCsAppConfig | https://github.com/dotnet/winforms/blob/main/docs/analyzers/ApplicationConfigurationGenerator.Help.md |
8+
| https://aka.ms/WfoCsAnalyzers | https://github.com/dotnet/winforms/blob/main/docs/analyzers/WinFormsCSharpAnalyzers.Help.md |
9+
| https://aka.ms/WfoVbAnalyzers | https://github.com/dotnet/winforms/blob/main/docs/analyzers/WinFormsVisualBasicAnalyzers.Help.md|

docs/analyzers/akams.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)