-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Set default parameter value if provided in RDG #47321
Copy link
Copy link
Closed
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-rdgold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Description
Give the code:
string HandleRequest(string name = "Safia") => $"Hello {name}!";
app.MapGet("/hello", HandleRequest);We emit the following code:
var name_raw = name_RouteOrQueryResolver(httpContext);
var name_temp = name_raw.Count > 0 ? (string?)name_raw : null;
string name_local = name_temp!;When we should be emitting:
var name_raw = name_RouteOrQueryResolver(httpContext);
var name_temp = name_raw.Count > 0 ? (string?)name_raw : "Safia";
string name_local = name_temp!;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-rdgold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels