-
Notifications
You must be signed in to change notification settings - Fork 4.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
Enable CA1052 (static holder types should be static) #65830
Conversation
@mavasani There are flagged public APIs here. I'll add suppressions. Meanwhile, would you like me to open an issue for any of these suggesting a breaking change to discuss in API review? |
IMO, it will be difficult to justify such a breaking change for a public API. @333fred for his views. |
public class CodeStyleOptions | ||
#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable |
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.
Same. We'd want to break things if anyone is instantiating these.
I guess I'm not convinced of the need to break those users. |
Instantiating these types would indicate something completely broken in their code. First, i'm skeptical this would even exist anywhere. Second, it doesn't seem like this code could even do anything (you can't access statics through instance values for example). So it would have ot exist, and be unused for any purpose. Compat around that seems unnecessary. But we can certainly bring to discussion. |
I guess I'm ok having that discussion. @Youssef1313, can you please open an issue? |
|
@mavasani I did a local build of
|
|
@mavasani This is ready for review, pending a question on why CI didn't fail for |
Why would we want to do this? I see nothing wrong in a non-static type with only static explicitly declared members. |
src/Compilers/CSharp/Test/Emit2/FlowAnalysis/PatternMatchingTest5.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/TypeResolutionTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/CodeAnalysisTest/Collections/List/SegmentedList.Generic.Tests.Misc.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Test2/GoToDefinition/GoToDefinitionTestsBase.vb
Outdated
Show resolved
Hide resolved
src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerFileReferenceTests.cs
Outdated
Show resolved
Hide resolved
08d8512
to
0b8f7af
Compare
@CyrusNajmabadi Can you restart the failing jobs please? Thank you! |
@CyrusNajmabadi Sorry for pinging again. I think you already restarted but one job is still failing. If you can restart once again please and review the PR as well. Thanks! |
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.
Compiler change LGTM
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.
IDE side lgtm.
Thanks @CyrusNajmabadi @333fred. There is a failing job if you can restart please. Also do we need a second approval on compilers side? |
This is green now. Can we get this merged please? @CyrusNajmabadi @jjonescz @333fred |
Thanks @Youssef1313 ! |
No description provided.