A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dotnet/aspnetcore/issues/46622 below:

[RDG] Route handlers with the same parameters but differing nullability produce compiler warnings · Issue #46622 · dotnet/aspnetcore · GitHub

At the moment, it's hard to use our strongly-typed overloads strategy to generate code that correctly handles two route handlers with the same parameters but differing nullability:

app.MapPost("/foo", (Todo todo) => ...);
app.MapPost("/bar", (Todo? todo) => ...);

We might consider generating two different strongly-typed overloads, one with the nullability annotations and one without:

MapPost(System.Action<Todo>);
MapPost(System.Action<Todo?>);

But overload resolution is not able to discern between the two delegate signatures and treats them as ambiguous overloads.

We can also emit only the overload that expects an NRT:

MapPost(System.Action<Todo?>);

But that presents a nullability warning to users (CS8622) when passing an overload to the delegate that does not expect an NRT.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4