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

SA1513 and SA1009 Conflict and code fixes fight between themselves #1713

Closed
vbfox opened this issue Oct 30, 2015 · 4 comments
Closed

SA1513 and SA1009 Conflict and code fixes fight between themselves #1713

vbfox opened this issue Oct 30, 2015 · 4 comments
Assignees
Milestone

Comments

@vbfox
Copy link

vbfox commented Oct 30, 2015

In this program :

using System;

class Program
{
    private class Foo : IDisposable
    {
        public int Bar { get; set; }

        public void Dispose()
        {
        }
    }

    static void Main(string[] args)
    {
        foreach (
            var x in
            new[]
            {
                1,
                2,
                3
            })
        {
        }

        using (
            new Foo
            {
                Bar = 1
            })
        {
        }

        Console.WriteLine(
            new[]
            {
                1,
                2,
                3
            });
    }
}

Both the foreach and using trigger SA1513 at the end, but it isn't solvable, applying the codefix will produce SA1009.

Also applying SA1513 code fix once doesn't work, it add a line break between } and ) but no new line, applying it a second time fixes it but SA1009 is still there.

@sharwell
Copy link
Member

@vweijsters What did StyleCop classic do for this case?

@vweijsters
Copy link
Contributor

SA1513 is not reported for the code above. After manually adding an empty line after the the closing brace, SA1009 is reported.

I would say that this should be corrected in SA1513, so that the code above will not raise SA1513.

@sharwell
Copy link
Member

Agreed, thanks!

@vweijsters
Copy link
Contributor

Grabbing this

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