Skip to content

#endif between method and its Attribute is getting deleted. #879

Description

@MineCake147E

Environment

  • Visual Studio version: Community Version 17.1.0 Preview 1.1
  • CodeMaid version: 12.0.300
  • Code language: C#

Description

I wrote this code:

namespace CodeMaidBugRepro
{
    public class Class1
    {
#if DEBUG
        [Obsolete]
#endif
        public uint A(uint b) => b;
    }
}

After running the code cleanup with CodeMaid, the #endif gets removed, making build impossible.

Steps to recreate

  1. Create a class library project.
  2. Write a method.
  3. Add [Obsolete] on top of the method. [DebuggerStepThrough] also gets affected.
  4. Surround the attribute with #if and #endif.
  5. Click on "Clean Up Active Documents" or turn on "Automatic Cleanup On Save" and save the document.

Current behavior

The #endif gets removed.

Expected behavior

The #endif should remain alive.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions