R# 7.1.2 formats code comments incorrectly

Hello,

I have the following code.

     public abstract class SingleFactory<T> where T : class, new()
     {
// ReSharper disable StaticFieldInGenericType
          private static readonly Lazy<T> SingleInstance = new Lazy<T>(() => new T());
// ReSharper restore StaticFieldInGenericType

          public static T Instance
          {
               get
               {
                    return SingleInstance.Value;
               }
          }
     }


When I'm using the  Cleanup Code option it will format it into this.

// ReSharper disable StaticFieldInGenericType
          private static readonly Lazy<T> SingleInstance = new Lazy<T>(() => new T());

// ReSharper restore StaticFieldInGenericType


Is there a way to change it so it won't create the blank line after the field?

4 comments
Comment actions Permalink

Why it takes ages for you to answer? can't you at least acknowledge it?

0
Comment actions Permalink

Can I get an answer please? I just want to know what's going on.

0
Comment actions Permalink

It looks like rule SA1515 from StyleCop ...

To improve the readability of the code, StyleCop requires blank lines in certain situations, and prohibits blank lines in other situations. This results in a consistent visual pattern across the code, which can improve recognition and readability of unfamiliar code.
A violation of this rule occurs when a single-line comment is not preceded by a blank line.

0
Comment actions Permalink

Thank you! I've disabled the rule and is no longer making this blank line. :)

0

Please sign in to leave a comment.