Autofac.Extensions.DependencyInjection
Autofac.Extensions.DependencyInjection copied to clipboard
In ASP.NET 8, IReadOnlyCollection<> controller parameters do not bind from request body by default in controllers
Describe the bug In ASP.NET 8 a controller with an IReadOnlyCollection<> parameter is not bound from the body of the request by default. An empty collection is seen by the controller. This worked in ASP.NET 6. We are currently trying to migrate from .NET 6 to .NET 8.
IReadOnlyList, Array and potentially some other collection types makes also trouble.
Autofac with ASP.NET 7 is also broken.
To reproduce
You can find a full working repro here: https://github.com/IT-CASADO/ParameterBindingIssue/tree/autofac
Full exception with stack trace:
no exception
Assembly/dependency versions:
<PackageReference Include="Autofac" Version="7.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
Additional context Add any other context about the problem here.