My asp.net core 3.1 project throws an exception if I include this package (context: I’m trying to create a custom Authorization policy):
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="5.0.3" />
This is the exception and method where it is thrown in startup.cs:
services.AddControllers();
System.ArgumentNullException: 'Value cannot be null. (Parameter 'configure')'
This is the complete list of packages. Is there some conflict that I'm not aware of? The package was suggested by VS when I created an AuthorizationHandler
class.
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.0.1" />
<PackageReference Include="Azure.Identity" Version="1.2.3" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.1.0" />
<PackageReference Include="CorrelationId" Version="3.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.15.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="5.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.9" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="7.5.2" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.2.0" />
<PackageReference Include="NSwag.AspNetCore" Version="13.8.2" />
Oops, looks like the answer was already available with a little more effort on my part. I resolved this by manually downgrading the package version to 3.1.12
as described here. Looks like VS gave me the .net version of the package instead of the .net core version.