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

RCS0005 reports False Positive when #endregion follows a #pragma line plus a blank line #1528

Closed
Bergam64 opened this issue Sep 17, 2024 · 0 comments · Fixed by #1533
Closed
Assignees

Comments

@Bergam64
Copy link

Bergam64 commented Sep 17, 2024

Product and Version Used:
VS extension Roslynator 2022 v4.12.5

Steps to Reproduce:

  • Enable RCS0005 in your .editorconfig file (disabled by default).
  • Open a C# file and follow example below.

Actual Behavior:

namespace MyNamespace
{
    /// <summary>
    /// ...
    /// </summary>
    public class Class1
    {
        #region MyRegion

#pragma warning disable 1591

        public int MyProperty { get; set; }

#pragma warning restore 1591

        #endregion // <-- RCS0005 is wrongly reported here, although there's a blank line above.
    }
}

Applying the code fix adds a blank line that is not needed, which causes RCS1036 (Remove unnecessary blank line) to be reported on that line:

namespace MyNamespace
{
    /// <summary>
    /// ...
    /// </summary>
    public class Class1
    {
        #region MyRegion

#pragma warning disable 1591

        public int MyProperty { get; set; }

#pragma warning restore 1591


        #endregion
    }
}

Expected Behavior:

namespace MyNamespace
{
    /// <summary>
    /// ...
    /// </summary>
    public class Class1
    {
        #region MyRegion

#pragma warning disable 1591

        public int MyProperty { get; set; }

#pragma warning restore 1591

        #endregion // <-- No RCS0005 reported here.
    }
}
@Bergam64 Bergam64 changed the title RCS0005: reports False Positive when #endregion follows a #pragma line plus a blank line RCS0005 reports False Positive when #endregion follows a #pragma line plus a blank line Sep 17, 2024
@josefpihrt josefpihrt self-assigned this Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants