-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[release/9.0] Fixing Analyzer issues, servicing, Part 1: Analyzer-test-infra refactoring. #13072
base: release/9.0
Are you sure you want to change the base?
[release/9.0] Fixing Analyzer issues, servicing, Part 1: Analyzer-test-infra refactoring. #13072
Conversation
73b4f7c
to
4d9825e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/9.0 #13072 +/- ##
=====================================================
- Coverage 74.83821% 74.80108% -0.03714%
=====================================================
Files 3022 2997 -25
Lines 630460 629261 -1199
Branches 46797 46742 -55
=====================================================
- Hits 471825 470694 -1131
+ Misses 155247 155204 -43
+ Partials 3388 3363 -25
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR performs a refactoring of the analyzer test infrastructure in preparation for servicing to .NET 9, along with updates to the analyzer release documentation. The changes include updating shipped and unshipped analyzer release markdown files with new rule sets, adjusting test data type casts in binary format tests, and removing legacy analyzer and code fix test files.
Reviewed Changes
File | Description |
---|---|
src/System.Windows.Forms.Analyzers/cs/src/Analyzers/AnalyzerReleases.Shipped.md | Added new shipped analyzer release details for .NET 9 and updated rule documentation URLs. |
src/System.Windows.Forms.Analyzers/cs/src/Analyzers/AnalyzerReleases.Unshipped.md | Introduced a new unshipped analyzer release file with corresponding documentation link. |
src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs | Adjusted type casting for test data concatenations to address type inference issues. |
src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/HashTableTests.cs | Updated construction of Point and PointF instances to use default values and adjusted pragma comment. |
src/System.Windows.Forms.Analyzers.CSharp/src/AnalyzerReleases.Shipped.md | Updated shipped analyzer releases by switching documentation paths and rule order. |
Various AssemblyInfo.cs and analyzer test files | Removed legacy AssemblyInfo and legacy test files no longer needed with the updated test infrastructure. |
Copilot reviewed 201 out of 201 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (4)
src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/HashTableTests.cs:236
- Changing from 'new Point()' to 'default(Point)' could potentially affect behavior if any constructor initialization is expected; please verify that the default value is appropriate in this context.
{ "Foo", default(Point) }
src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/HashTableTests.cs:240
- Replacing 'new PointF()' with 'default(PointF)' may alter the initialization behavior; ensure that this change aligns with the intended default state for PointF.
{ "Foo", default(PointF) }
src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/MissingPropertySerializationConfiguration/ControlPropertySerializationDiagnosticAnalyzerTest.cs:1
- [nitpick] Confirm that the removal of this test file does not leave functionality untested and that equivalent coverage is provided elsewhere.
<entire file removed>
src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/AvoidPassingTaskWithoutCancellationToken/AvoidPassingTaskWithoutCancellationTokenTest.cs:1
- [nitpick] Ensure that the scenarios covered by the removed test are still validated through alternative tests to maintain comprehensive test coverage for task cancellation behavior.
<entire file removed>
…g the VB part from the C# part.
2ff2fe0
to
b3c8d72
Compare
Note, that the Analyzer MD files have not changed, so, what Copilot reported there is just new from the new folder perspective. |
pkg/Microsoft.Private.Winforms/Microsoft.Private.Winforms.csproj
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Analyzers/cs/src/Analyzers/AnalyzerReleases.Unshipped.md
Outdated
Show resolved
Hide resolved
Please update winforms/eng/Localize/LocProject.json Line 111 in ae9c058
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking for the new test infra, i.e. where you load the test files, but I assume that test infra is coming next?
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/AxSystemMonitorTests.cs.bak
Outdated
Show resolved
Hide resolved
...ndows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/CollectionEditorTests.cs.bak
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/System.Windows.Forms.Primitives.csproj
Outdated
Show resolved
Hide resolved
...em.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/WinformsControlsTest.csproj.bak
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments.
src/System.Windows.Forms.Analyzers/generic/tests/Microsoft.WinForms/CodeTestDataAttribute.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Analyzers/generic/tests/Microsoft.WinForms/CodeTestDataAttribute.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Analyzers/generic/tests/Microsoft.WinForms/CodeTestDataAttribute.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Analyzers/generic/tests/Microsoft.WinForms/NetVersion.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Analyzers/generic/tests/Microsoft.WinForms/CodeTestDataAttribute.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Analyzers/generic/tests/Microsoft.WinForms/TestFileLoader.cs
Outdated
Show resolved
Hide resolved
* Add the file to the solution items for better discoverability.
f61875f
to
19e5925
Compare
* Patch the LocProject.json file with the new file pathes and ... * Add that file to the solution items for better discoverability. * Remove redundant backup files.
19e5925
to
fe3dd24
Compare
{ | ||
if (s_exactNetVersionLookup.TryGetValue(version, out (string tfm, string exactVersion) value)) | ||
{ | ||
var netRuntimePackage = new PackageIdentity(NetRuntimeIdentity, value.exactVersion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to double-check that exactVersion
is required
Part 1 of servicing Analyzer back to .NET 9 rel.
This is JUST updating the test infrastructure; it does not change anything else.
Note:
The respective migration to .NET 10 is done here: #13112.
The touched files seem like a lot, but it's basically only file moves, and it does NOT effect the runtime itself, which makes it a low risk:
This is a compact visual guide, of how the folders moved:
In more words:
Projects which are the actual WinForms runtime, are not effected - except the Analyzer Projects themselves. And here, we just changed the folders where they lived, but we did not change anything in terms of file content. The reason to do this already in the context of the release fix was, that the changes which need to come after this for the actual Analyzer fixes (in 9REL) and then later for the add-ons (in 10Preview) bring Path length in many cases too close and (while testing) in 2 cases also OVER the maximum path length. That, and the fact that this PR does not change anything in the runtime, was one of the reasons, I decided to move the pure folder restructuring already to this PR, because bottom line, it will be actually safer to have the same Analyzer folder structure in the release branches and the upcoming versions, when we need to backport fixes.
You will note though, that some versions of a series of NuGet changed, which also are part of the release fix. And yes, those also might effect the runtime, but most of the changes again are either Analyzer-related or Test related. There was also one item we needed to change because its original version was flagged as having an security issue - which is documented in the versions file.
I decided to update the a series of the NuGets in addition, since they seem logical to update.
Updating the NuGet packages to the minimum versions which felt at least right and safe to have, required some minor, low-risk code changes, due to breaking changes. But again: Those changes are EXCLUSIVELY affecting the test code, and we have those changes for month in the .NET 10 branch, so also here, I feel really safe to apply them, and assess them as low risk.
Finally, there is a bigger picture of the TreeViews (left old, right new), which gives you more details about the moves, but which is visually more "demanding" 😸:
We're still considering, if we go for "Common" or "Generic" for the generic Analyzer Project, but that would just be a name change, and change nothing in principle.
Code, which this PR adds:
You see, that this PR adds a bit of new code. That is basically the foundation of the new Analyzer Test Infrastructure, so that the fixes we need to apply will have also new tests to back the fixes up, which will be compatible to the code, we are going forward with in .NET 10.
But again: This ONLY effects the unit tests. It does not make any changes necessary per se to the existing Analyzer code, let alone does it changes anything in the runtime. The files which get added here for supporting the new test infrastructure are all bundled here:
Microsoft Reviewers: Open in CodeFlow