Why ins't inlining working here?

Just doing an experiment. The following code are not inlined by the compiler:

class Program
{
    static void Main(string[] args)
    {
        int k = DoFoo(10, 20);
    }
    
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static int DoFoo(int i, int b)
    {
        return i + b;
    }
}


https://sharplab.io/#gist:692cc1af66c352c2e8138dad6f033959
C#/VB/F# compiler playground.
Was this page helpful?