Andrew Casey
Andrew Casey
Both ctors of `CookiePolicyMiddleware` are really old, but @halter73 might have some idea how this could break a DI consumer.
This isn't my area, but my immediate reaction is that a 5.0 project (out-of-support) using Autofac 7.1 (from 2020, but not officially deprecated) is probably not a top priority. If...
I did my best to follow the minimal repro steps (except that I'm on win11 and 9.0.0-preview.7.24406.2) and I didn't see the exception.
I made a devbox to play around. The exception appears to be new between 9.0.0-preview.7.24406.2 and 9.0.0-rc.1.24416.6.
From the stack, it appears that `TryFindPreferredConstructor` failed so it's using `TryFindMatchingConstructor`. There are two constructors and the single argument type is `Microsoft.AspNetCore.Http.RequestDelegate`.
Inspecting the signatures, it looks like there should also be an `IOptions`. Edit: this appears to be the same in P7, so it's probably a red herring.
This difference seems interesting to me (I picked a different middleware type that _isn't_ broken): ``` RC1 > Microsoft.AspNetCore.HttpsPolicy.dll!Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware.HttpsRedirectionMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Configuration.IConfiguration config, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) Line 36 C# [Lightweight...
Hmm https://github.com/dotnet/aspnetcore/pull/55722
I updated to autofac 8 and I no longer see the exception. Can you please confirm, @Junjun-zhao? Edit: 7.2 seems to work as well. Confirmed that downgrading to 7.1 brings...
The [internal](https://github.com/dotnet/aspnetcore/blob/f22b35078a992e4bff2429f517e28a30907689cb/src/Shared/ActivatorUtilities/ActivatorUtilities.cs#L40) `ActivatorUtilities` used match length as a tie-breaker, whereas the ["official"](https://github.com/dotnet/runtime/blob/ce8f49e658d4a31e5708f0c06efa39784ee7c1ad/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ActivatorUtilities.cs#L616) one does not.