Skip to content

Convert delegate to local function suggested fix breaks code in expressions #24344

@UnoSD

Description

@UnoSD

Version Used:
2.6.0.62329 (5429b35)
Visual Studio 15.5.2

Steps to Reproduce:

void Method(Action action)
{
            
}

Expression<Action> Example()
{
    Action action = () => Method(null);

    return () => Method(action);
}

Expected Behavior:
Not to suggest a fix

Actual Behavior:
A fix is suggested to replace the delegate with a local function; if fix is implemented it breaks the code as local functions cannot be referenced by expression trees.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions