Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
UnoSD opened this issue Jan 19, 2018 · 1 comment
Closed
Assignees
Labels
Area-IDE Bug Feature - Local Functions Local Functions Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@UnoSD
Copy link

UnoSD commented Jan 19, 2018

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.

@sharwell sharwell added the help wanted The issue is "up for grabs" - add a comment if you are interested in working on it label Jan 22, 2018
@MaStr11
Copy link
Contributor

MaStr11 commented Jan 23, 2018

This seems to be fixed by #23136. I made a PR with the test case with the snippet from above here #24391. Note: I'm not sure why the version used by @UnoSD offered the fix because #23136 was merged a few days before (but into a different branch).

@sharwell sharwell added 4 - In Review A fix for the issue is submitted for review. Feature - Local Functions Local Functions and removed Feature - Local Functions Local Functions help wanted The issue is "up for grabs" - add a comment if you are interested in working on it labels Jan 23, 2018
@sharwell sharwell added this to the 15.6 milestone Jan 23, 2018
@sharwell sharwell self-assigned this Jan 23, 2018
sharwell pushed a commit to MaStr11/roslyn that referenced this issue Jan 23, 2018
@sharwell sharwell added Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented and removed 4 - In Review A fix for the issue is submitted for review. labels Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Feature - Local Functions Local Functions Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

4 participants