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

CA1806 - False-negative for IQueryable Take() #7030

Closed
pacoteinnov opened this issue Nov 14, 2023 · 0 comments · Fixed by #7182
Closed

CA1806 - False-negative for IQueryable Take() #7030

pacoteinnov opened this issue Nov 14, 2023 · 0 comments · Fixed by #7182

Comments

@pacoteinnov
Copy link

Analyzer

Diagnostic ID: CA1806: Do not ignore method results

Analyzer source

NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers

Version: 7.0.4 (Latest)

Describe the bug

This code using IQueryable does not output CA1806 warning

IQueryable<int> queryable = (new int[] { 0, 1 }).AsQueryable();
queryable.Take(1);

But with IEnumerable it does

IEnumerable<int> enumerable= new int[] { 0, 1 };
enumerable.Take(1);

Steps To Reproduce

Use the code above with latest analysis package.
<AnalysisMode>All</AnalysisMode> does not change the behavior.

Expected behavior

Warning CA1806 with IQueryable methods that returns values.

Actual behavior

No warning CA1806 with IQueryable methods that returns values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant