You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Study of "System.ComponentModel" projects in github.com/dotnet/dotnet-api-docs ..
of the 84 projects, "<TargetFramework>.." need changing [assuming MS prefer LTS v8] :-
76x from "net6.0-windows" to "net8.0-windows"
8x from "net6.0" to "net8.0"
on applying all the Analyzer recommendations (lightbulbs), e.g. IDE300 Collection initialization can be simplified
to WinForms projects, e.g. dotnet-api-docs\snippets\csharp\System.ComponentModel\AmbientValueAttribute\Overview\form1.cs
from numericUpDown1.Maximum = new decimal(new int[] { 1410065408, 2, 0, 0 });
to numericUpDown1.Maximum = new decimal([1410065408, 2, 0, 0]);
the build succeeds but GUI Designer fails The designer cannot process the code at line 197, please see the Task List for details. The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
ditto dotnet-api-docs\snippets\csharp\System.ComponentModel\AmbientValueAttribute\Overview\attributesdemocontrol.cs
from DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
to DataGridViewCellStyle dataGridViewCellStyle1 = new();
ditto dotnet-api-docs\snippets\csharp\System.ComponentModel\AsyncCompletedEventArgs\Overview\primenumbercalculatormain.cs line 472 from
for 2-5 above the Designer should correctly parse the latest valid C# code [like the CSC build engine does]
otherwise should emit // <auto-generated> ..
to inhibit Analyzers refactoring such fragile code
I am working on PR #10965 to address most of these gripes [expect soon], so suggest MS holds off remediation
hoping that product owners will accept [mostly or cherry-pick] such contribution to improve the docs !
except many (12) Warnings [that I will not attempt to re-code as better attempted by domain experts] CS0618 'RecommendedAsConfigurableAttribute' is obsolete: 'RecommendedAsConfigurableAttribute has been deprecated. Use System.ComponentModel.SettingsBindableAttribute instead.'
summary of various Warnings/Messages issued on build of these 84 projects [I hacked together a dick.SLN]
Warning
Message
Code
Description
0
12
CA1507
Using nameof helps keep your code valid when refactoring.
0
1
CA1510
Throw helpers are simpler and more efficient than an if block constructing a new exception instance.
0
22
CA1822
Members that do not access instance data or call instance methods can be marked as static ..
0
1
CA1824
The NeutralResourcesLanguage attribute informs the ResourceManager of the language ..
0
4
CA1825
Avoid unnecessary zero-length array allocations. Use Array.Empty() instead.
0
1
CA1830
StringBuilder.Append and StringBuilder.Insert provide overloads for multiple types beyond System.String ..
0
1
CA1847
'string.Contains(char)' is available as a better performing overload for single char lookup.
0
4
CA1859
Using concrete types avoids virtual or interface call overhead and enables inlining.
0
7
CA1861
Constant arrays passed as arguments are not reused when called repeatedly ..
0
1
CA1862
Avoid calling 'ToLower', 'ToUpper', 'ToLowerInvariant' and 'ToUpperInvariant' to perform case-insensitive string comparisons ..
0
2
CA2208
A call is made to the default (parameterless) constructor of an exception type that is or derives from ArgumentException ..
12
0
CS0618
'RecommendedAsConfigurableAttribute' is obsolete: 'RecommendedAsConfigurableAttribute has been deprecated. Use System.ComponentModel.SettingsBindableAttribute instead.'
15
0
CS0649
Field 'Form1.components' is never assigned to, and will always have its default value null
0
1
IDE0018
Variable declaration can be inlined
0
5
IDE0019
Use pattern matching
0
3
IDE0028
Collection initialization can be simplified
0
10
IDE0031
Null check can be simplified
0
16
IDE0032
Use auto property
0
2
IDE0036
Modifiers are not ordered
0
1
IDE0038
Use pattern matching
0
61
IDE0044
Make field readonly
0
37
IDE0049
Name can be simplified
0
7
IDE0059
Avoid unnecessary value assignments in your code ..
0
4
IDE0060
Avoid unused parameters in your code ..
0
18
IDE0065
Using directives must be placed outside of a namespace declaration
0
1
IDE0074
Use compound assignment
0
1
IDE0083
Use pattern matching
0
60
IDE0090
'new' expression can be simplified
0
40
IDE0130
Namespace "BackgroundWorkerExample" does not match folder structure, expected "backgroundworkersimple"
0
2
IDE0290
Use primary constructor
0
1
IDE0300
Collection initialization can be simplified
0
8
IDE1005
Delegate invocation can be simplified.
0
235
IDE1006
Naming rule violation: Missing prefix: '_'
0
2
RCS1001
Add braces to for statement (when expression spans over multiple lines)
0
11
RCS1015
Use nameof operator
0
30
RCS1032
Remove redundant parentheses
0
1
RCS1033
Remove redundant '== true'
0
22
RCS1036
([deprecated] Use RCS0063 instead) Remove unnecessary blank line
0
402
RCS1037
Remove trailing white-space
0
2
RCS1047
Remove suffix 'Async' from non-asynchronous method name
0
2
RCS1073
Convert 'if' to 'return' statement
0
11
RCS1085
Use auto-implemented property
0
3
RCS1097
Remove redundant 'ToString' call
0
3
RCS1098
Constant values should be placed on right side of comparisons
9
0
RCS1102
Make class static
0
55
RCS1110
Declare 'DemoControlDesigner' inside namespace
0
1
RCS1113
Use 'string.IsNullOrEmpty' method
0
62
RCS1114
Remove redundant delegate creation
0
35
RCS1118
Mark local variable as const
0
1
RCS1132
Remove redundant overriding method
1
0
RCS1139
Add summary element to documentation comment
0
12
RCS1146
Use conditional access
1
0
RCS1155
Use StringComparison when comparing strings
0
2
RCS1159
Use EventHandler
0
2
RCS1160
Abstract type should not have public constructors
0
8
RCS1163
Unused parameter 'args'
0
54
RCS1169
Make field read-only
0
1
RCS1179
Unnecessary assignment
0
2
RCS1192
Unnecessary usage of verbatim string literal
0
8
RCS1212
Remove redundant assignment
0
29
RCS1213
Remove unused method declaration
0
1
RCS1220
Use pattern matching instead of combination of 'is' operator and cast operator
0
1
RCS1225
Make class sealed
0
1
RCS1226
Add paragraph to documentation comment
-
-
-
-
38
2481
subtotals
The text was updated successfully, but these errors were encountered:
Describe the issue or suggestion
Study of "System.ComponentModel" projects in github.com/dotnet/dotnet-api-docs ..
of the 84 projects,
"<TargetFramework>.."
need changing [assuming MS prefer LTS v8] :-76x from "net6.0-windows" to "net8.0-windows"
8x from "net6.0" to "net8.0"
on applying all the Analyzer recommendations (lightbulbs), e.g.
IDE300 Collection initialization can be simplified
to WinForms projects, e.g.
dotnet-api-docs\snippets\csharp\System.ComponentModel\AmbientValueAttribute\Overview\form1.cs
from
numericUpDown1.Maximum = new decimal(new int[] { 1410065408, 2, 0, 0 });
to
numericUpDown1.Maximum = new decimal([1410065408, 2, 0, 0]);
the build succeeds but GUI Designer fails
The designer cannot process the code at line 197, please see the Task List for details. The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
ditto dotnet-api-docs\snippets\csharp\System.ComponentModel\AmbientValueAttribute\Overview\attributesdemocontrol.cs
from
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
to
DataGridViewCellStyle dataGridViewCellStyle1 = new();
ditto dotnet-api-docs\snippets\csharp\System.ComponentModel\AsyncCompletedEventArgs\Overview\primenumbercalculatormain.cs line 472 from
to
ditto dotnet-api-docs\snippets\csharp\System.ComponentModel\BackgroundWorker\IsBusy\Form1.cs lines 230, 235, 243
for 2-5 above the Designer should correctly parse the latest valid C# code [like the CSC build engine does]
otherwise should emit
// <auto-generated> ..
to inhibit Analyzers refactoring such fragile code
BTW the error text displayed in 2-5 above is omitted in the docs at Windows Forms Designer error page
I am working on PR #10965 to address most of these gripes [expect soon], so suggest MS holds off remediation
hoping that product owners will accept [mostly or cherry-pick] such contribution to improve the docs !
except many (12) Warnings [that I will not attempt to re-code as better attempted by domain experts]
CS0618 'RecommendedAsConfigurableAttribute' is obsolete: 'RecommendedAsConfigurableAttribute has been deprecated. Use System.ComponentModel.SettingsBindableAttribute instead.'
summary of various Warnings/Messages issued on build of these 84 projects [I hacked together a dick.SLN]
The text was updated successfully, but these errors were encountered: