question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SA1402 does not recognise structs

See original GitHub issue

Given the file Foo.cs:

internal class Foo
{
}

internal struct Baz
{
}

internal class Bar
{
}

Only the class Bar generates a warning; see screenshot below showing struct Baz does not have green squiggly. image

Also, given Baz.cs:

internal struct Baz
{
}

internal class Bar
{
}

internal class Foo
{
}

class Bar does not generate a warning for SA1402 image Changing struct Baz to class Baz suddenly makes SA1402 appear for class Bar image

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sharwellcommented, Apr 29, 2016

Duplicate of #1756. We’ve actually already approved changing the behavior of SA1402 (which would require corresponding documentation updates), but no one has taken it on yet. 😄

1reaction
appel1commented, Mar 15, 2016

If you change the behavior of the rule or make it configurable I think it should also be renamed to avoid confusion. The current name, SA1402FileMayOnlyContainASingleClass, makes it very obvious that it only applies it classes.

If it is made configurable don’t forget interface, enum and delegate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SA1402 does not fire for record classes · Issue #3542
In other words, I view record as being a modifier/subcategory of the class and struct categories, not a category on its own (this...
Read more >
Sa1402 Weekend Admission for Acute Cholangitis Does ...
Weekend hospital admission is not associated with adverse outcomes, namely longer LOS, decreased or delayed ERCP, organ failure, or mortality. Additional ...
Read more >
c# - One class per file rule in .NET?
I follow this rule but some of my colleagues disagree with it and argue that if a class is smaller it can be...
Read more >
Attenuating Staphylococcus aureus Virulence by Targeting ...
We identify several small-molecule compounds that alter flotillin oligomerization, thus affecting the degradosome activity and reducing. S.
Read more >
S.Amdt.1406 to S.2657 - 116th Congress (2019-2020)
In the case of a hearing initiated on a complaint, the refund effective date shall be-- ``(i) not earlier than the date on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found