Skip to content

Commit aebf53f

Browse files
wip
1 parent f790266 commit aebf53f

File tree

92 files changed

+2406
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2406
-370
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Whilst most .NET Core/.NET components are cross-platform Windows Forms implement
1717
Please do:
1818

1919
* **DO** follow our [coding style][coding-style] (C# code-specific)<br/>
20-
We strive to wrap the lines around 120 mark, and it's acceptable to stretch to no more than 150 chars (with some exceptions being URLs). [EditorGuidelines VS extension](https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines) makes it easier to visualise (see https://github.com/dotnet/winforms/pull/4836).
20+
We strive to wrap the lines around 120 mark, and it's acceptable to stretch to no more than 150 chars (with some exceptions being URLs). [EditorGuidelines VS extension](https://marketplace.dev.azure.com/items?itemName=PaulHarrington.EditorGuidelines) makes it easier to visualise (see https://github.com/dotnet/winforms/pull/4836).
2121
* **DO** give priority to the current style of the project or file you're changing even if it diverges from the general guidelines.
2222
* **DO** include tests when adding new features. When fixing bugs, start with
2323
adding a test that highlights how the current behavior is broken.

Winforms.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -1187,10 +1187,10 @@ Global
11871187
{C4C031D5-F79A-44B6-811E-0797E7D5C1C1} = {E4C6C5F5-46E9-4C63-9628-26752B4D9C11}
11881188
{0FD53580-3175-4F8F-8372-BE46C9122EE0} = {583F1292-AE8D-4511-B8D8-A81FE4642DDC}
11891189
{B653C860-9B52-4597-9921-24DA79A4E6B1} = {583F1292-AE8D-4511-B8D8-A81FE4642DDC}
1190+
{607E02DD-4256-4E73-B9A4-4CE2673B3703} = {DF68A171-D27B-4E6A-8A7E-63A651622355}
11901191
{656C66A4-59CD-4E14-8AE4-1F5BCEECB553} = {8B4B1E09-B3C7-4044-B223-94EDEC1CAA20}
11911192
{D4D97D78-D213-45DF-B003-9C4C9F2E5E1C} = {8B4B1E09-B3C7-4044-B223-94EDEC1CAA20}
11921193
{442C867C-51C0-8CE5-F067-DF065008E3DA} = {77FEDB47-F7F6-490D-AF7C-ABB4A9E0B9D7}
1193-
{607E02DD-4256-4E73-B9A4-4CE2673B3703} = {583F1292-AE8D-4511-B8D8-A81FE4642DDC}
11941194
EndGlobalSection
11951195
GlobalSection(ExtensibilityGlobals) = postSolution
11961196
SolutionGuid = {7B1B0433-F612-4E5A-BE7E-FCF5B9F6E136}

docs/analyzers/WinFormsCSharpAnalyzers.Help.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,23 @@ set to `DesignerSerializationVisibility.Content` or `DesignerSerializationVisibi
3232

3333
|Item|Value|
3434
|-|-|
35-
| Category | ApplicationConfiguration |
35+
| Category | WinForms Security |
36+
| Enabled | True |
37+
| Severity | Warning |
38+
| CodeFix | False |
39+
---
40+
41+
## `ImplementITypedDataObjectInAdditionToIDataObject`
42+
43+
`ImplementITypedDataObjectInAdditionToIDataObject` checks for custom implementations of the managed `IDataObject` interface and suggests to also implement the `ITypedDataObject` interface.
44+
45+
### [WFO1001](https://aka.ms/winforms-warnings/WFO1001): Implement ITypedDataObject interface in addition to IDataObject.
46+
47+
Custom data objects must implement `ITypedDataObject` interface in order to support the best practices in reading binary formatted data from the Clipboard or data being dragged and dropped.
48+
49+
|Item|Value|
50+
|-|-|
51+
| Category | WinForms Security |
3652
| Enabled | True |
3753
| Severity | Warning |
3854
| CodeFix | False |

docs/coding-style.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ internal bool SingleVerticalBorderAdded
164164
### Nullability
165165

166166
1. Prefer [pattern matching](https://learn.microsoft.com/dotnet/csharp/language-reference/operators/patterns) to check variable type and null state (e.g. `if (parameter is Form form)`, `if (manager.GetService<IContainer>() is { } container)`, etc.).
167-
1. Using the postfix `!` [null-forgiving operator](https://learn.microsoft.com/dotnet/csharp/language-reference/operators/null-forgiving) to override null analysis must always get a descriptive comment. Prefer to refactor code to avoid this where possible. If we do not control the code in question prefer to throw `ArgumentException` when an associated argument is known or `InvalidOperationException` otherwise. Do not let code fall into `NullReferenceException`.
167+
1. Using the postfix `!` [null-forgiving operator](https://learn.microsoft.com/dotnet/csharp/language-reference/operators/null-forgiving) to override null analysis must always get a descriptive comment. Prefer to re-factor code to avoid this where possible. If we do not control the code in question prefer to throw `ArgumentException` when an associated argument is known or `InvalidOperationException` otherwise. Do not let code fall into `NullReferenceException`.
168168

169169
### Visual Basic
170170

docs/developer-guide.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Windows Forms requires the following workloads and components be selected when i
2424
```
2525

2626
* Useful Visual Studio extensions:
27-
* [Editor guidelines](https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines), see https://github.com/dotnet/winforms/pull/4836 for more information
28-
* [VS Color Output](https://marketplace.visualstudio.com/items?itemName=MikeWard-AnnArbor.VSColorOutput64)
29-
* [Productivity Power Tools](https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.ProductivityPowerPack2022)
27+
* [Editor guidelines](https://marketplace.dev.azure.com/items?itemName=PaulHarrington.EditorGuidelines), see https://github.com/dotnet/winforms/pull/4836 for more information
28+
* [VS Color Output](https://marketplace.dev.azure.com/items?itemName=MikeWard-AnnArbor.VSColorOutput64)
29+
* [Productivity Power Tools](https://marketplace.dev.azure.com/items?itemName=VisualStudioPlatformTeam.ProductivityPowerPack2022)
3030

3131
## Workflow
3232

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
; Unshipped analyzer release
22
; https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
3+
### New Rules
4+
5+
Rule ID | Category | Severity | Notes
6+
--------|----------|----------|-------
7+
WFO1001 | WinForms Security | Warning | CSharpDiagnosticDescriptors

src/System.Windows.Forms.Analyzers.CSharp/src/Resources/SR.resx

+11-1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
<data name="WFO1000AnalyzerMessageFormat" xml:space="preserve">
154154
<value>Property '{0}' does not configure the code serialization for its property content</value>
155155
</data>
156+
156157
<data name="AddDesignerSerializationVisibilityCodeFixTitle" xml:space="preserve">
157158
<value>Add DesignerSerializationVisibilityAttribute to property</value>
158159
</data>
@@ -165,4 +166,13 @@
165166
<data name="WFO2001AnalyzerMessageFormat" xml:space="preserve">
166167
<value>Task is being passed to InvokeAsync without a cancellation token</value>
167168
</data>
168-
</root>
169+
<data name="WFO1001AnalyzerMessageFormat" xml:space="preserve">
170+
<value>Custom data object {0} does not implement `ITypedDataObject` interface</value>
171+
</data>
172+
<data name="WFO1001AnalyzerTitle" xml:space="preserve">
173+
<value>`ITypedDataObject` interface is is not implemented by a custom data object</value>
174+
</data>
175+
<data name="WFO1001AnalyzerDescription" xml:space="preserve">
176+
<value>Custom data object must implement `ITypedDataObject` interface in order to support the best practices in reading binary formatted data from the Clipboard or data being dragged and dropped.</value>
177+
</data>
178+
</root>

src/System.Windows.Forms.Analyzers.CSharp/src/Resources/xlf/SR.cs.xlf

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/System.Windows.Forms.Analyzers.CSharp/src/Resources/xlf/SR.de.xlf

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/System.Windows.Forms.Analyzers.CSharp/src/Resources/xlf/SR.es.xlf

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/System.Windows.Forms.Analyzers.CSharp/src/Resources/xlf/SR.fr.xlf

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/System.Windows.Forms.Analyzers.CSharp/src/Resources/xlf/SR.it.xlf

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)