You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In .NET 7, when IServiceProviderIsService.IsService was introduced, the ASP.NET Core framework attempts to detect if something is a service, and if we indicate it is, that will be used as the source of binding, as opposed to the [FromBody] binding, which was the default before.
In Autofac rules, all collections are valid services (but with an empty set if no registrations have been made), so from .NET 7 on, ASP.NET Core will inject empty collections from Autofac instead of binding the body content.
We should add to our docs for ASP.NET Integration to detail this point and indicate that users should be explicit with [FromBody] where appropriate to prevent automatic service injection.
In .NET 7, when
IServiceProviderIsService.IsService
was introduced, the ASP.NET Core framework attempts to detect if something is a service, and if we indicate it is, that will be used as the source of binding, as opposed to the[FromBody]
binding, which was the default before.In Autofac rules, all collections are valid services (but with an empty set if no registrations have been made), so from .NET 7 on, ASP.NET Core will inject empty collections from Autofac instead of binding the body content.
We should add to our docs for ASP.NET Integration to detail this point and indicate that users should be explicit with
[FromBody]
where appropriate to prevent automatic service injection.See autofac/Autofac.Extensions.DependencyInjection#114
The text was updated successfully, but these errors were encountered: