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

Fix S1144: Do not keep references to all type symbols #2203

Closed
valhristov opened this issue Jan 3, 2019 · 0 comments
Closed

Fix S1144: Do not keep references to all type symbols #2203

valhristov opened this issue Jan 3, 2019 · 0 comments
Assignees
Labels
Type: Bug Exceptions and blocking issues during analysis.
Milestone

Comments

@valhristov
Copy link
Contributor

valhristov commented Jan 3, 2019

Description

We keep references to all found type symbols in order to be able to look for usages a second time when the compilation ends and report for unused internal symbols. These references put huge memory pressure and the analysis is very slow on large projects which do not have InternalsVisibleTo attributes.

Related bug report #2154

Repro steps

  • Create a project with many (~1000) large classes, containing internal members.
  • Make sure there is no InternalsVisibleTo attributes in the project.
  • Analyze with S1144 enabled.

Expected behavior

The analysis takes reasonable amount of time. For example, on a project with 1000 classes with complex syntax trees (about 300 loc) the analysis should take about 2min or less. The used memory from the compiler is reasonable (on the example project, no more than 1GB).

Actual behavior

Analysis takes 20+ minutes on the aforementioned project. On larger projects the analysis takes much more (see #2154) and the used memory during the compilation is >2GB.

Known workarounds

  • Disable S1144
  • Add InternalsVisibleTo attribute

Related information

  • SonarC# 7.9
@valhristov valhristov added Type: Bug Exceptions and blocking issues during analysis. Area: Rules labels Jan 3, 2019
@valhristov valhristov added this to the 7.10 milestone Jan 3, 2019
@valhristov valhristov self-assigned this Jan 3, 2019
@ghost ghost added the Status: Needs Review label Jan 3, 2019
@ghost ghost removed the Status: Needs Review label Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Exceptions and blocking issues during analysis.
Projects
None yet
Development

No branches or pull requests

1 participant