Skip to content

BRO1006: Preprocessor keywords should not be preceded by a space

#if, not # if. Replaces StyleCop SA1006.

Example

Before

public class Settings
{
# if DEBUG
    public bool Verbose = true;
# endif
}

After

public class Settings
{
#if DEBUG
    public bool Verbose = true;
#endif
}

Why

The keyword belongs to the #; every other directive in the codebase is written that way, and searching for #if finds them all.

How the fix works

The fix removes the whitespace between # and the keyword. Indentation before the # stays.

Compared with StyleCop

Same positions and output as StyleCop.