dotnet / dotnet/aspnetcore

Analyzer: Warn on `IEnumerable` minimal API parameters that don't have explicit binding source

Open
#67,575 0 comments 0 reactions 0 assignees View on GitHub
analyzer area-minimal
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

See #65084 for context.

It's easy for users to try to use `IEnumerable` or `IEnumerable` in minimal API parameters, which will be treated as a service parameter.

### Describe the solution you'd like

An analyzer that warns on these parameters and require the user to either have `[FromServices]` or `[FromBody]` so that the intent is clear.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reading issue #65084 for the binding behavior and then locate the existing minimal API analyzer entry point and its tests. Done means the analyzer warns for IEnumerable parameters without an explicit binding source while allowing parameters marked with [FromServices] or [FromBody].

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.