Puresharp icon indicating copy to clipboard operation
Puresharp copied to clipboard

Async methods cause null reference exception

Open marktoman opened this issue 5 years ago • 1 comments

When I pass a .NET Core 2.2 exe to IPuresharp, it fails if the exe has async methods that contain certain constructs:

using System;
using System.Threading.Tasks;

namespace AsyncWeavingTest
{
    class Program
    {
        static void Main(string[] args) { }

        // Works
        Task Method1() => Task.CompletedTask;
        void Method2() { var t = new Task(() => { }); t.Start(); }
        async Task Async1() { }
        async Task Async2() { var t = new Task(() => { }); t.Start(); }
        async Task Async3() { await new Task(() => { }); }

        // Fails
        async Task Async4() { var t = new Task(() => { }); t.Start(); await t; }
        async Task Async5() { await Task.CompletedTask; }
    }
}

Also, thank you for this project. I was looking for a decent AOP solution for quite a while.

marktoman avatar Mar 27 '19 00:03 marktoman

Thank you for sharing issue, I will try it as soon as possible.

Puresharper avatar Mar 28 '19 14:03 Puresharper