codemaid icon indicating copy to clipboard operation
codemaid copied to clipboard

CodeMaid inserts excplicit private access modifier for partial methods

Open Risord opened this issue 3 years ago • 2 comments

Environment

  • Visual Studio version: 2022 Community 17.2.4
  • CodeMaid version: 12.0
  • Code language: C#

Description

CodeMaid inserts excplicit "private" access modifier for partial methods.

namespace ExampleNamespace
{
    public partial class ExampleClass
    {
        partial void ExampleMethod();
    }
}

Current behavior

Private access modifier is added to method which is not valid C# code and won't compile.

namespace ExampleNamespace
{
    public partial class ExampleClass
    {
        private partial void ExampleMethod();
    }
}

Expected behavior

namespace ExampleNamespace
{
    public partial class ExampleClass
    {
        partial void ExampleMethod();
    }
}

Risord avatar Aug 11 '22 06:08 Risord

Thank you for reporting the issue. I believe this is related to an underlying SDK issue introduced in VS2022. There are some more details in #879 and a link over to the Roslyn SDK issue. The recommended workaround at this time is to disable the CodeMaid options that insert explicit access modifiers.

codecadwallader avatar Aug 19 '22 12:08 codecadwallader

Is it possible to temporarily add an option to disable adding modifiers for partial methods? Turning it off completely simply because of partials, feels like a waste imho

Yukihana avatar May 08 '24 16:05 Yukihana