Shaolinq icon indicating copy to clipboard operation
Shaolinq copied to clipboard

AsyncRewriter fails when used on expression body method

Open asizikov opened this issue 8 years ago • 0 comments

Steps to reproduce:

  • Create class library project targeting .NET 4.6
  • Install Shaolinq.AsyncRewriter 1.1.1.989
  • Create new class:
    public partial class Class1
    {
        [RewriteAsync]
        public int Foo() => 10;
    }
  • Try to build the project

This will produce an invalid C# code in GeneratedAsync.cs file:

namespace ClassLibrary3
{
#pragma warning disable
    using System;
    using System.Threading;
    using System.Threading.Tasks;
    using global::ClassLibrary3;

    public partial class Class1
    {
        public Task<int> FooAsync()
        {
            return FooAsync(CancellationToken.None);
        }

        => 10;
        public async Task<int> FooAsync(CancellationToken cancellationToken) => 10;
    }
}

asizikov avatar Oct 11 '16 13:10 asizikov