Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Add COMAnalyzer - #2306

Merged
mateoatr merged 8 commits into
dotnet:mainfrom
mateoatr:comAnalyzer
Oct 18, 2021
Merged

mateoatr merged 8 commits into
dotnet:mainfrom
mateoatr:comAnalyzer

Conversation

@mateoatr

@mateoatr mateoatr commented Oct 4, 2021

Copy link
Copy Markdown
Contributor

Rebased #2275 on top of main. ILLinkAnalyzer test checker was validating ExpectedWarningAttributes for any diagnostic id -- I made changes in this PR so that we only validate diagnostic ids supported by the analyzer we are testing:
https://github.com/mateoatr/linker/blob/a540731187a7a0f1a7beb3d648d79003c589e4a6/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs#L34-L39

@mateoatr
mateoatr requested a review from sbomer October 6, 2021 16:07
{
Trimmer = 1,
Analyzer = 2,
RequiresAssemblyFileAnalyzer = 2,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it's leaking implementation details. We shouldn't need to know which analyzer produces it, only if it's a diagnostic currently produced by any of the analyzers.

@mateoatr mateoatr Oct 7, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then that would be a problem whenever some test suite in Mono.Linker.Tests.Cases has ExpectedWarning with warning codes for different analyzers, no? e.g., say you have A.cs with:

[ExpectedWarning("ILXXXX", ProducedBy = ProducedBy.Analyzer)] // This is only produced by analyzer A
[ExpectedWarning("ILYYYY", ProducedBy = ProducedBy.Analyzer)] // This is only produced by analyzer B
void Foo () { ... }

Since analyzer tests are ran separately, when running the tests in A.cs with analyzer A, we'd fail since it wouldn't produce ILYYYY; similar when running A.cs tests with B, in which case we'd be missing ILXXXX.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also allow to pass multiple analyzers to RunTest in the analyzer test infra, if that makes more sense than having all analyzers in the enum.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is leaking details a bit due to the impedance mismatch between the linker/analyzer test infrastructure - running with all the analyzers would be good to avoid this. But I like this approach as a way to ignore some expected warnings when testing with only one analyzer for now. Maybe it's worth a comment here to say why we have the individual enum values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #2315 to track this.

@mateoatr
mateoatr requested review from agocke and sbomer October 11, 2021 23:15

@sbomer sbomer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM!

{
Trimmer = 1,
Analyzer = 2,
RequiresAssemblyFileAnalyzer = 2,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is leaking details a bit due to the impedance mismatch between the linker/analyzer test infrastructure - running with all the analyzers would be good to avoid this. But I like this approach as a way to ignore some expected warnings when testing with only one analyzer for now. Maybe it's worth a comment here to say why we have the individual enum values.

@mateoatr
mateoatr merged commit 3418bcd into dotnet:main Oct 18, 2021
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
* Add COM Analyzer

* Add IsComInterop
Run Interop tests

* PR feedback

* Rename variables in GetTestFilesByDirName

* Extend ProducedBy with enum values for each supported analyzer

* Lint

* PR feedback

* Return ProducedBy instead of list

Commit migrated from dotnet/linker@3418bcd
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants