-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-rdf
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
RDF generates buggy code for endpoints with a:
- struct parameter type
- endpoint filter
- null value for the parameter
System.NullReferenceException
Object reference not set to an instance of an object.
at lambda_method111(Closure, Object, HttpContext, Object[])
at Microsoft.AspNetCore.Http.RequestDelegateFactory.<>c__DisplayClass99_0.<<HandleRequestBodyAndCompileRequestDelegate>b__0>d.MoveNext() in /Users/captainsafia/repos/2-aspnetcore/src/Http/Http.Extensions/src/RequestDelegateFactory.cs:line 1198
Expected Behavior
Invoking request delegate should not produce an exception.
Steps To Reproduce
var app = WebApplication.Create();
app.MapGet("/struct-with-filter", (BindableStructWithNullReturn param) => "Hello world!")
.AddEndpointFilter((c, n) => n(c));
app.Run();
public struct BindableStructWithNullReturn
{
public static async ValueTask<BindableStructWithNullReturn?> BindAsync(HttpContext httpContext, ParameterInfo parameter)
{
await Task.CompletedTask;
return null;
}
}
Exceptions (if any)
No response
.NET Version
8.0.100-preview.7.23360.1
Anything else?
No response
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 etcfeature-rdf