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 S3963 FP: Static constructor with conditional and no static filed initialization #6343

Closed
teo-tsirpanis opened this issue Nov 9, 2022 · 1 comment · Fixed by #9512
Closed
Assignees
Labels
Area: C# C# rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@teo-tsirpanis
Copy link
Contributor

Description

I have a class with no static fields whose static constructor does some stuff, yet S3963 gets triggered.

Repro steps

https://github.com/TileDB-Inc/TileDB-CSharp/blob/b5a5966adbd551c161b1ed80fa8e07a7f7275111/tests/TileDB.CSharp.Test/TestUtil.cs#L8-L14

Expected behavior

No warnings.

Actual behavior

S3963 appears.

Known workarounds

Suppress it.

Related information

  • SonarAnalyzer.CSharp version: 8.48.0.56517
  • Visual Studio version: 17.4
costin-zaharia-sonarsource added a commit that referenced this issue Nov 11, 2022
@costin-zaharia-sonarsource costin-zaharia-sonarsource added Type: False Positive Rule IS triggered when it shouldn't be. Area: C# C# rules related issues. labels Nov 11, 2022
@pavel-mikula-sonarsource pavel-mikula-sonarsource changed the title S3963 appears in a static constructor that does not initialize static fields. Fix S3963 FP: A static constructor that does not initialize static fields Nov 14, 2022
costin-zaharia-sonarsource added a commit that referenced this issue Nov 14, 2022
@sebastien-marichal sebastien-marichal added the Sprint: Hardening Fix FPs/FNs/improvements label Jul 9, 2024
@sebastien-marichal sebastien-marichal changed the title Fix S3963 FP: A static constructor that does not initialize static fields Fix S3963 FP: Static constructor with conditional and no static filed initialization Jul 9, 2024
@sebastien-marichal sebastien-marichal added this to the 9.29 milestone Jul 10, 2024
@teo-tsirpanis
Copy link
Contributor Author

Thanks @sebastien-marichal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
4 participants