-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error inside Container #116
Comments
Can you attach your Program.cs and Startup.cs? It looks like something going sideways in the DataProtection code but I'm not sure why. |
Also what platform are you on .net core 2.0, net 4.6.2? Windows, linux? |
Ok I was able to track the problem down to a change MS made to their own code and opened an issue. I'll look at adding some type of black listing feature for concrete types that works off names (the type is internal so it has to be name not typeof()). Sorry you have to be the guinea pig, I didn't realize they were making so many DI refactoring changes that would ripple like this. |
This won't be addressed till MS releases asp.net core 2.1 so to bridge that gap I'll add a feature to Grace to allow you to black list types from being auto-registered (Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver specifically). I'll see about doing a release in the next couple days to add this feature. |
Sorry about this 😞 |
@davidfowl these things happen especially when you have so many moving part that can be swapped in and out. |
@ipjohnson thanks for the fast support, i will wait for the Grace release =D |
@tiagorosendo I've pushed a beta package if you could give it a whirl that would be great. You'll need to add a call to container.Configure(c =>
c.ExcludeTypeFromAutoRegistration("Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver")); |
@tiagorosendo I'm going to close this out and push an official release tomorrow. Let me know if you run into any other asp.net 2.0 compatibility issues. Thanks. |
When i try to run inside a container with aspnet:2.0 base image, i get this error:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Win32.Registry' threw an exception. ---> System.PlatformNotSupportedException: Registry is not supported on this platform.
at Microsoft.Win32.RegistryKey.OpenBaseKeyCore(RegistryHive hKey, RegistryView view)
at Microsoft.Win32.Registry..cctor()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver.<>c.<.ctor>b__2_0()
at Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver.ResolvePolicy()
at Microsoft.AspNetCore.DataProtection.Internal.KeyManagementOptionsSetup.Configure(KeyManagementOptions options)
at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at Microsoft.Extensions.Options.OptionsManager1.<>c__DisplayClass5_0.b__0()
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at Microsoft.Extensions.Options.OptionsCache1.GetOrAdd(String name, Func1 createOptions) at Microsoft.Extensions.Options.OptionsManager1.Get(String name)
at Microsoft.Extensions.Options.OptionsManager1.get_Value() at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager..ctor(IOptions1 keyManagementOptions, IActivator activator, ILoggerFactory loggerFactory)
at lambda_method(Closure , IExportLocatorScope , IDisposalScope , IInjectionContext )
at Grace.DependencyInjection.Lifestyle.SingletonLifestyle.ProvideLifestyleExpression(IInjectionScope scope, IActivationExpressionRequest request, Func2 activationExpression) at Grace.DependencyInjection.Impl.Expressions.ActivationExpressionBuilder.GetExpressionFromStrategyCollection(IInjectionScope scope, IActivationExpressionRequest request) at Grace.DependencyInjection.Impl.Expressions.ActivationExpressionBuilder.GetActivationExpressionFromStrategies(IInjectionScope scope, IActivationExpressionRequest request) at Grace.DependencyInjection.Impl.Expressions.ActivationExpressionBuilder.GetActivationExpression(IInjectionScope scope, IActivationExpressionRequest request) at Grace.DependencyInjection.Impl.Expressions.ConstructorExpressionCreator.GetParameterExpression(ParameterInfo parameter, ConstructorParameterInfo parameterInfo, IInjectionScope injectionScope, TypeActivationConfiguration configuration, IActivationExpressionRequest request) at Grace.DependencyInjection.Impl.Expressions.ConstructorExpressionCreator.GetParameterExpressionsForConstructor(IInjectionScope injectionScope, TypeActivationConfiguration configuration, IActivationExpressionRequest request, ConstructorInfo constructor) at Grace.DependencyInjection.Impl.Expressions.ConstructorExpressionCreator.CreateExpression(IInjectionScope scope, IActivationExpressionRequest request, TypeActivationConfiguration activationConfiguration) at Grace.DependencyInjection.Impl.Expressions.TypeExpressionBuilder.GetActivationExpression(IInjectionScope scope, IActivationExpressionRequest request, TypeActivationConfiguration activationConfiguration) at Grace.DependencyInjection.Lifestyle.SingletonLifestyle.ProvideLifestyleExpression(IInjectionScope scope, IActivationExpressionRequest request, Func2 activationExpression)
at Grace.DependencyInjection.Impl.Expressions.ActivationExpressionBuilder.GetExpressionFromStrategyCollection(IInjectionScope scope, IActivationExpressionRequest request)
at Grace.DependencyInjection.Impl.Expressions.ActivationExpressionBuilder.GetActivationExpressionFromStrategies(IInjectionScope scope, IActivationExpressionRequest request)
at Grace.DependencyInjection.Impl.Expressions.ActivationExpressionBuilder.GetActivationExpression(IInjectionScope scope, IActivationExpressionRequest request)
at Grace.DependencyInjection.Impl.Expressions.ConstructorExpressionCreator.GetParameterExpression(ParameterInfo parameter, ConstructorParameterInfo parameterInfo, IInjectionScope injectionScope, TypeActivationConfiguration configuration, IActivationExpressionRequest request)
at Grace.DependencyInjection.Impl.Expressions.ConstructorExpressionCreator.GetParameterExpressionsForConstructor(IInjectionScope injectionScope, TypeActivationConfiguration configuration, IActivationExpressionRequest request, ConstructorInfo constructor)
at Grace.DependencyInjection.Impl.Expressions.ConstructorExpressionCreator.CreateExpression(IInjectionScope scope, IActivationExpressionRequest request, TypeActivationConfiguration activationConfiguration)
at Grace.DependencyInjection.Impl.Expressions.TypeExpressionBuilder.GetActivationExpression(IInjectionScope scope, IActivationExpressionRequest request, TypeActivationConfiguration activationConfiguration)
at Grace.DependencyInjection.Lifestyle.SingletonLifestyle.ProvideLifestyleExpression(IInjectionScope scope, IActivationExpressionRequest request, Func`2 activationExpression)
at Grace.DependencyInjection.Impl.Expressions.ArrayExpressionCreator.GetActivationExpressionResultsFromStrategies(IInjectionScope scope, IActivationExpressionRequest request, Type arrayElementType)
at Grace.DependencyInjection.Impl.Expressions.ArrayExpressionCreator.GetArrayExpressionList(IInjectionScope scope, IActivationExpressionRequest request, Type arrayElementType)
at Grace.DependencyInjection.Impl.Expressions.ArrayExpressionCreator.GetArrayExpression(IInjectionScope scope, IActivationExpressionRequest request)
at Grace.DependencyInjection.Impl.Expressions.ActivationExpressionBuilder.GetActivationExpression(IInjectionScope scope, IActivationExpressionRequest request)
at Grace.DependencyInjection.Impl.ActivationStrategyCompiler.LocateEnumerableStrategy(IInjectionScope scope, Type locateType, ActivationStrategyFilter consider, Object key)
at Grace.DependencyInjection.Impl.ActivationStrategyCompiler.FindDelegate(IInjectionScope scope, Type locateType, ActivationStrategyFilter consider, Object key, IInjectionContext injectionContext, Boolean checkMissing)
at Grace.DependencyInjection.Impl.InjectionScope.InternalLocate(IExportLocatorScope scope, IDisposalScope disposalScope, Type type, ActivationStrategyFilter consider, Object key, IInjectionContext injectionContext, Boolean allowNull, Boolean isDynamic)
at Grace.DependencyInjection.Impl.InjectionScope.LocateOrDefault(Type type, Object defaultValue)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
The text was updated successfully, but these errors were encountered: