Skip to content

Unannotated parameters in disabled nullability context should be treated as optional #35507

Closed
@captainsafia

Description

@captainsafia

The following code sample in minimal APIs:

#nullable disable
app.MapGet("/{id}", (int id) => $"Id: {id}");

will treat id as a required parameter even though the user likely intended it to be optional. Not providing the parameter in the scenario above will cause a 400 during runtime.

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcbugThis issue describes a behavior which is not expected - a bug.feature-minimal-actionsController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions