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

Highlight capturing lambdas #39850

Open
alrz opened this issue Nov 16, 2019 · 3 comments
Open

Highlight capturing lambdas #39850

alrz opened this issue Nov 16, 2019 · 3 comments
Labels
Area-IDE Feature Request Need Design Review The end user experience design needs to be reviewed and approved.
Milestone

Comments

@alrz
Copy link
Member

alrz commented Nov 16, 2019

Even with static lambdas, it's hard to spot capturing lambdas that are not intended to be.

A different formatting such as underlining => would help to fix those and possibly mark as static.

@sharwell sharwell added Feature Request Need Design Review The end user experience design needs to be reviewed and approved. labels Nov 27, 2019
@sharwell sharwell added this to In Queue in IDE: Design review via automation Nov 27, 2019
@jinujoseph jinujoseph added this to the Backlog milestone Dec 4, 2019
@jmarolf jmarolf moved this from In Queue to On deck in IDE: Design review Jan 31, 2022
@sharwell
Copy link
Member

sharwell commented Mar 7, 2022

There are 4 scenarios where I've needed information related to this:

  1. The lambda captures one or more arguments to the method and the method contains a path to return which does not construct the lambda. In this case, the arguments will be placed in a box (with allocation) even when the lambda delegate is not created.
  2. The lambda does not capture anything (effectively static).
  3. The lambda only captures this (non-static).
  4. The lambda captures one or more locals/arguments, and thus will always trigger an allocation for the creation of the delegate.

@Cosifne
Copy link
Member

Cosifne commented Mar 7, 2022

Design meeting conclusion:
We want to solve the problem by layering, also we don’t oppose to if it is a capturing lambda behind, underlying the arrow operator. But we prefer the layer way.)

@Cosifne Cosifne moved this from On deck to Need Update in IDE: Design review Mar 7, 2022
@Cosifne Cosifne moved this from Need Update to On deck in IDE: Design review Mar 7, 2022
@alrz
Copy link
Member Author

alrz commented Mar 13, 2022

There are 4 scenarios where I've needed information related to this:

That seems to overlap with a general feature to highlight allocations. Is that something to consider here?

edit: It's already here: https://github.com/microsoft/RoslynClrHeapAllocationAnalyzer

@jmarolf jmarolf moved this from On deck to Complete in IDE: Design review Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request Need Design Review The end user experience design needs to be reviewed and approved.
Projects
Status: Complete
IDE: Design review
  
Complete
Development

No branches or pull requests

5 participants