Puresharper / Puresharp

Puresharp is a Framework that provides the essential APIs (AOP, IOC, etc...) to productively build high quality (.NET 4.5.2+ & .NET Core 2.1+) applications through reliability, scalability and performance without no compromise
MIT License
143 stars 17 forks source link

Build error when you have a static async method #10

Closed iandawson closed 5 years ago

iandawson commented 5 years ago

Hi,

Using version 4.2.2 I get a build error whenever there is a static asynchronous method in a class. The simplest example I can give is just to create the following class in an empty class library

public class TestService
    {
        public DateTime GetDateAddDays(int daysToAdd)
        {
            return DoDateAddition(daysToAdd).Result;
        }

        private static async Task<DateTime> DoDateAddition(int daysToAdd)
        {
            return DateTime.Now.AddDays(daysToAdd);
        }
    }

Reference the puresharp libraries and do a build.

It fails with the following error

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
    Parameter name: field
       at Mono.Cecil.Cil.Instruction.Create(OpCode opcode, FieldReference field)
       at IPuresharp.Machine.Manage(MethodDefinition method)
       at IPuresharp.Authority..ctor(TypeDefinition type)
       at IPuresharp.Program.Manage(TypeDefinition type)
       at IPuresharp.Program.Manage(String assembly)
       at IPuresharp.Program.Main(String[] arguments)
C:\Temp\PureSharp\Repro\PureSharpBug\packages\IPuresharp.4.2.2\build\IPuresharp.targets(10,5): error MSB3073: The command ""C:\Temp\PureSharp\Repro\PureSharpBug\packages\IPuresharp.4.2.2\build\IPuresharp.exe" "C:\Temp\PureSharp\Repro\PureSharpBug\PureSharpBug\PureSharpBug.csproj" "Debug"" exited with code -532462766.
Puresharper commented 5 years ago

Thank you for report, I will test it as soon as possible.

Edit : I just test it now and fix it in new version 4.2.3. I already upload the packages, You just need to wait nuget validation to update you nuget reference. Thank you again for this issue report.