|
3 | 3 | System.Windows.Forms.Analyzers analyzers and source generators are shipped inbox with Windows Desktop .NET SDK, and
|
4 | 4 | are automatically referenced for Window Forms .NET applications.
|
5 | 5 |
|
6 |
| -## `AppManifestAnalyzer` |
| 6 | +## `MissingPropertySerializationConfiguration` |
7 | 7 |
|
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. |
9 | 10 |
|
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. |
11 | 12 |
|
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 | |
14 | 23 |
|
15 |
| -|Item|Value| |
16 |
| -|-|-| |
17 |
| -| Category | ApplicationConfiguration | |
18 |
| -| Enabled | True | |
19 |
| -| Severity | Warning | |
20 |
| -| CodeFix | False | |
21 | 24 | ---
|
22 | 25 |
|
23 |
| -## `MissingPropertySerializationConfiguration` |
| 26 | +## `AvoidPassingFuncReturningTaskWithoutCancellationToken` |
24 | 27 |
|
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. |
27 | 29 |
|
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. |
29 | 31 |
|
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 | |
32 | 41 |
|
33 |
| -|Item|Value| |
34 |
| -|-|-| |
35 |
| -| Category | WinForms Security | |
36 |
| -| Enabled | True | |
37 |
| -| Severity | Warning | |
38 |
| -| CodeFix | False | |
39 | 42 | ---
|
40 | 43 |
|
41 | 44 | ## `ImplementITypedDataObject`
|
42 | 45 |
|
43 | 46 | `ImplementITypedDataObject` checks custom implementations of the managed `IDataObject` interface and suggests to also implement the `ITypedDataObject` interface.
|
44 | 47 |
|
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`. |
46 | 49 |
|
47 | 50 | 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`.
|
48 | 51 |
|
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 | + |
55 | 60 | ---
|
0 commit comments