Skip to content
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

Run code quality analyzers in the coreclr/tools directory #74825

Merged
merged 11 commits into from
Sep 1, 2022

Conversation

tlakollo
Copy link
Contributor

@tlakollo tlakollo commented Aug 30, 2022

Adds the <RunAnalyzers> property set to true into the different ilc projects
Adds some custom configurations into the editorconfig of ilc

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM once the CI green

@tlakollo tlakollo changed the title Run codeanalysis analyzers in the coreclr/tools directory Run code quality analyzers in the coreclr/tools directory Aug 30, 2022
@tlakollo
Copy link
Contributor Author

cc @dotnet/crossgen-contrib @dotnet/ilc-contrib
This basically touches on almost every file from the coreclr/tools directory, which could create merge conflicts. Any objections on merging?

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Looks good otherwise, thanks for cleaning it up!

}
Copy link
Member

Choose a reason for hiding this comment

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

Can you please check if this should be "ported" to linker repo as well? (Probably the setting for lint to do this for us).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened https://github.com/dotnet/linker/issues/3018 to track enabling runtime code-quality analyzer on top of existing linker analyzers

await MergeSortCore<T, T[], ArrayAccessor<T>, TComparer, TCompareAsEqualAction>.ParallelSort(localCopyOfHalfOfArray, 0, halfLen, comparer);
await rightSortTask;
await MergeSortCore<T, T[], ArrayAccessor<T>, TComparer, TCompareAsEqualAction>.ParallelSort(localCopyOfHalfOfArray, 0, halfLen, comparer).ConfigureAwait(true);
await rightSortTask.ConfigureAwait(true);
Copy link
Member

Choose a reason for hiding this comment

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

Why true rather than false?

Copy link
Contributor Author

@tlakollo tlakollo Aug 31, 2022

Choose a reason for hiding this comment

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

¯\_(ツ)_/¯
I'm not familiar with what is happening in the code and although less performant and deadlock prone, using ConfigureAwait(true) does virtually the same as just awaiting for it. If you believe it should be false, I can change it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will merge it as is for now, let me know if you want me to create a follow-up change about this :D

Copy link
Member

Choose a reason for hiding this comment

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

It's very rare to see ConfigureAwait(true) and it's usually for a very specific reason. These should almost certainly be false.

@tlakollo tlakollo merged commit ab2d195 into dotnet:main Sep 1, 2022
@tlakollo tlakollo deleted the EnableCodeAnalysisAnalyzers branch September 1, 2022 20:02
MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this pull request Sep 2, 2022
dotnet#74825 (review)

I don't think we need to run on the same thread.
MichalStrehovsky added a commit that referenced this pull request Sep 5, 2022
#74825 (review)

I don't think we need to run on the same thread.
MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this pull request Sep 29, 2022
The `readonly` addition was one of the 3600 diffs in dotnet#74825. `MarkStrategy` can have mutable state that was getting lost because Roslyn considers it valid to put `_marker` into a temporary before calling instance methods on it.

This resulted in DependencyGraphViewer hanging after seeing tens of thousands of new graphs being added.
jkotas pushed a commit that referenced this pull request Sep 29, 2022
The `readonly` addition was one of the 3600 diffs in #74825. `MarkStrategy` can have mutable state that was getting lost because Roslyn considers it valid to put `_marker` into a temporary before calling instance methods on it.

This resulted in DependencyGraphViewer hanging after seeing tens of thousands of new graphs being added.
@ghost ghost locked as resolved and limited conversation to collaborators Oct 2, 2022
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.

5 participants