-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add analyzer to check for closing over loop variable #10476
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
Comments
I'd like to have a try at this, but would need a bit of guidance. Would this need to go into the Razor folder with the "RZ" diagnostics in ComponentDiagnosticFactory ? Or is it actually a more general diagnostic that should move up a folder into the RazorDiagnosticFactory as it could be useful in Razor Pages as well as Components? Thanks |
@danroth27 Realised I should probably tag someone 😄 |
@SQL-MisterMagoo this would likely go here: https://github.com/dotnet/aspnetcore/tree/master/src/Components/Analyzers/src. |
@pranavkm Thanks - I'll concentrate on that area |
@pranavkm @danroth27 Would you want a code fix along with the analyzer? |
@pranavkm Do you have any tips on how I can test a new analyzer in a project (not unit tests/e2e tests, but manually to see if everything is working like the error list in VS looks correct etc...)? |
Dupe of #25252. |
A lot of users are stumbling over the C# behavior of closing a delegate over a loop variable:
We should consider providing an analyzer that detects this case and warns.
The text was updated successfully, but these errors were encountered: