Retargeting from 6.0 to 7.0, can't run Angular/React ~ individual auth with error:Could not load type 'System.Security.Cryptography.RSA'
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
System.TypeLoadException
HResult=0x80131522
Message=Could not load type ‘System.Security.Cryptography.RSA’ from assembly ‘System.Security.Cryptography, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.
Source=Microsoft.AspNetCore.ApiAuthorization.IdentityServer
StackTrace:
at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.LoadKey()
at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.Configure(ApiAuthorizationOptions options)
at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at Microsoft.Extensions.Options.UnnamedOptionsManager
1.get_Value()
at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderConfigurationExtensions.<>c.<AddClients>b__8_1(IServiceProvider sp)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.AspNetCore.Builder.IdentityServerApplicationBuilderExtensions.TestService(IServiceProvider serviceProvider, Type service, ILogger logger, String message, Boolean doThrow) in //src/IdentityServer/Configuration/IdentityServerApplicationBuilderExtensions.cs:line 150
at Microsoft.AspNetCore.Builder.IdentityServerApplicationBuilderExtensions.Validate(IApplicationBuilder app) in //src/IdentityServer/Configuration/IdentityServerApplicationBuilderExtensions.cs:line 74
at Microsoft.AspNetCore.Builder.IdentityServerApplicationBuilderExtensions.UseIdentityServer(IApplicationBuilder app, IdentityServerMiddlewareOptions options) in /_/src/IdentityServer/Configuration/IdentityServerApplicationBuilderExtensions.cs:line 36
at Program.<Main>$(String[] args) in C:\Users\v-wajian\Angular70Ind\Program.cs:line 46
Expected Behavior
No response
Steps To Reproduce
Install Steps: Clean Win10 21H2 ENU + Dev17.1 Preview 3 + .NET 7.0(7.0.100-alpha.1.21568.2)
Repro Steps:
- Add feed for 6.0 and 7.0.
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
- Download and install latest nodejs.org from: https://nodejs.org
- Open commandline, create Angular ~ individual auth
dotnet new Angular -au individual -o Angular
- Open VS, retarget the traget framework from 6.0 to 7.0, and update all package to “7.0.0-xxx”
- F5 to run.
Exceptions (if any)
No response
.NET Version
7.0.100-alpha.1.21568.2
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Let’s close it for now as no-repro. I tried in the repro steps with the latest build and they worked for me.
The part that likely caused this was:
If those packages were newer than the old build of the runtime that was in this installer that explains this. Please reopen as an issue in dotnet/runtime if you can reproduce with the latest build of the SDK.
When you are updating packages, try to choose those from the matching build of the runtime that you are using. Here’s the one I used: https://gist.github.com/ericstj/4dc5ab7b633e0b0fc0f773d03615a971 This was with SDK version 7.0.100-alpha.1.22060.3 which used ASP.NET 7.0.0-alpha.1.22057.17, runtime 7.0.0-alpha.1.22059.2
Thanks for looking at this @ericstj and @bartonjs . Should this issue be transferred to the runtime repo?