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

SA1134 exception for auto-properties #3728

Open
LukeOwlclaw opened this issue Nov 15, 2023 · 1 comment
Open

SA1134 exception for auto-properties #3728

LukeOwlclaw opened this issue Nov 15, 2023 · 1 comment

Comments

@LukeOwlclaw
Copy link

SA1134 prevents attributes from sharing the line with other code.

Consider this line of code:

public bool? DisableCaching { get; [UsedImplicitly] set; }

[UseImplicitly] is a Resharper annotation to avoid "Auto-property accessor never used warning" (UnusedAutoPropertyAccessor.Global).

Making this auto-property span over three lines just to avoid SA1134 seems wrong:

public bool? DisableCaching { get;
    [UsedImplicitly]
    set; }

Disabling the rule also "costs" three lines:

#pragma warning disable SA1134
    public bool? DisableBundling { get; [UsedImplicitly] set; }
#pragma warning restore SA1134

Can we have an exception for SA1134 for this case (like we already have for attributes for (type) parameters)?

@gtbuchanan
Copy link

gtbuchanan commented Nov 15, 2023

Related to (but not a duplicate of) #1938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants