diff --git a/src/CodeGenHelpers/MethodBuilder.cs b/src/CodeGenHelpers/MethodBuilder.cs index 497a41a..5e2b01d 100644 --- a/src/CodeGenHelpers/MethodBuilder.cs +++ b/src/CodeGenHelpers/MethodBuilder.cs @@ -216,6 +216,13 @@ internal override void Write(in CodeWriter writer) foreach (var attribute in _attributes) writer.AppendLine($"[{attribute}]"); + + if (IsAbstract) + { + writer.AppendLine($"{output};"); + return; + } + using (writer.Block(output.Trim(), _generics.Contraints())) { _methodBodyWriter?.Invoke(writer); diff --git a/tests/CodeGenHelpers.Tests/SampleCode/SampleAbstractMethod.cs b/tests/CodeGenHelpers.Tests/SampleCode/SampleAbstractMethod.cs index 9c3bdc6..cb1b63f 100644 --- a/tests/CodeGenHelpers.Tests/SampleCode/SampleAbstractMethod.cs +++ b/tests/CodeGenHelpers.Tests/SampleCode/SampleAbstractMethod.cs @@ -11,8 +11,6 @@ namespace CodeGenHelpers.SampleCode { partial class SampleAbstractMethod { - abstract void MyAbstractMethod() - { - } + abstract void MyAbstractMethod(); } }