icsharpcode/ILSpy

delegate addition not using +=

Open

#1755 opened on Oct 21, 2019

View on GitHub
 (5 comments) (0 reactions) (0 assignees)C# (25,162 stars) (3,645 forks)batch import
C#DecompilerEnhancementHelp Wanted

Description

Ver. tested: d2f72583 Tested with multiple csc compilers.

class C
{
    public delegate void Del_t();
    Del_t dels;
    public void fn()
    {
        dels += cb;
    }
    private void cb() {}
}

Expected: fn to decompile to src form. Actual:

public void fn()
{
    dels = (Del_t)Delegate.Combine(dels, new Del_t(cb));
}

I could have sworn this used to work. Have I been dreaming? Is it a regression?

Contributor guide