bflattened / bflat

C# as you know it but with Go-inspired tooling (small, selfcontained, and native executables)
GNU Affero General Public License v3.0
3.56k stars 102 forks source link

Delegate type definition missmatch in zerolib #168

Closed theonly112 closed 4 months ago

theonly112 commented 4 months ago

I've attempted to create a small application that uses a delegate to call a static function. Here is the minimal code to reproduce the issue:

using System;
class Program
{
    public static void Main()
    {
        SomeHandler handler = new SomeHandler(Stuff);
        handler.Invoke();
    }
    private static void Stuff()
    {
        Console.WriteLine("stuff");
    }
    public delegate void SomeHandler();
}

When compiling with the '--stdlib:zero' flag this results in the following exception for me: System.InvalidOperationException: Expected field 'm_extraFunctionPointerOrData' not found on type '[zerolib]System.Delegate' The problem seems to be that there is a missmatch in the naming in the "m_extraFunctionPointerOrData" field. In the zerolib this field is called "_extraFunctionPointerOrData".

I would have attempted to submit a PR with the change but i did not yet have the time to setup my machine to build bflat locally.