Open Closed

Invariant Culture Error #5886


User avatar
0
augustin.couval@manuloc.eu created
  • ABP Framework version: v7.3.2
  • .net7.0
  • UI Type:Blazor Server
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

Hello,

I'm trying to deploy my application on a docker server from Portainer.

I'm having a problem launching the DbMigrator project.

  • Exception message and full stack trace:
[07:57:50 INF] Started database migrations...
[07:57:50 INF] Migrating schema for host database...
[07:57:56 INF] Executing host database seed...
Unhandled exception. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.Identity.IdentityDataSeedContributor -> Volo.Abp.Identity.IdentityDataSeeder -> Castle.Proxies.IdentityUserManagerProxy -> Volo.Abp.Identity.IdentityProUserStore -> Volo.Abp.Features.FeatureChecker -> λ:Volo.Abp.Features.IFeatureDefinitionManager -> Volo.Abp.Features.FeatureDefinitionManager -> Volo.Abp.FeatureManagement.DynamicFeatureDefinitionStore -> Volo.Abp.FeatureManagement.FeatureDefinitionSerializer -> Volo.Abp.Localization.LocalizableStringSerializer.
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Volo.Abp.Localization.AbpLocalizationOptions])' on type 'LocalizableStringSerializer'.
 ---> System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
cs is an invalid culture identifier.
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at Volo.Abp.Localization.LanguageInfo.ChangeCultureInternal(String cultureName, String uiCultureName, String displayName)
   at Volo.Abp.Localization.LanguageInfo..ctor(String cultureName, String uiCultureName, String displayName, String flagIcon)
   at Budget.BudgetDomainModule.<>c.<ConfigureServices>b__0_1(AbpLocalizationOptions options) in /src/src/Budget.Domain/BudgetDomainModule.cs:line 54
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
   at lambda_method335(Closure, Object[])
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   --- End of inner exception stack trace ---
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Builder.RegistrationBuilder`3.&lt;&gt;c__DisplayClass41_0.&lt;PropertiesAutowired&gt;b__0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
   at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
   at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Budget.Data.BudgetDbMigrationService.SeedDataAsync(Tenant tenant) in /src/src/Budget.Domain/Data/BudgetDbMigrationService.cs:line 104
   at Budget.Data.BudgetDbMigrationService.MigrateAsync() in /src/src/Budget.Domain/Data/BudgetDbMigrationService.cs:line 54
   at Budget.DbMigrator.DbMigratorHostedService.StartAsync(CancellationToken cancellationToken) in /src/src/Budget.DbMigrator/DbMigratorHostedService.cs:line 36
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Budget.DbMigrator.Program.Main(String[] args) in /src/src/Budget.DbMigrator/Program.cs:line 28
   at Budget.DbMigrator.Program.&lt;Main&gt;(String[] args) 

I have seen several possible solutions to this problem:

set the invariantCultre Env variable in the dockerFile

I did it:

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

I have this issue only when i lauch the DbMigrator Projet from portainer. When I run the project locally, I don't get any errors Can you help me to sole this problem


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try to add InvariantGlobalization to DbMigrator

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <InvariantGlobalization>true</InvariantGlobalization>
      </PropertyGroup>
    
    </Project>
    

    https://learn.microsoft.com/en-us/dotnet/core/runtime-config/globalization

  • User Avatar
    0
    augustin.couval@manuloc.eu created

    I've added what you told me in the DbMigrator project but I still get the same error.

    Do you have another idea?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I have no other idea.

  • User Avatar
    0
    augustin.couval@manuloc.eu created

    Do you need more information about the project to try and find a solution?

  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Try using FROM mcr.microsoft.com/dotnet/aspnet:7.0 for your DbMigrator Dockerfile if you are using slim version or any other.

  • User Avatar
    0
    pierremih created

    Solved by removing the configurations related to globalization and setting the proper base images in dockerfiles as you recommended.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19