title: Localisation in Asp.Net Core 3.1 not working after updatig from versin 2.2
body: <p>We had a website in Asp.net core version 2.2.
  We have updated the website from version 2.2 to 3.1.</p>
  
  <p>The same code we were using for the localization in version 2.2 is not working after updating the application to version 3.1.</p>
  
  <p>I have put the code on <a href="https://github.com/gurpreet42/MyAppV3" rel="nofollow noreferrer">github.com/gurpreet42/MyAppV3</a>. Please check and suggest changes.</p>
  
  <p>Following section shows the startup.cs file content</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
  
   services.AddSingleton&lt;LocService&gt;();
  
   services.AddLocalization(options =&gt; options.ResourcesPath = "Resources");
  
              services.Configure&lt;RequestLocalizationOptions&gt;(options =&gt;
              {
                  var supportedCultures = new List&lt;CultureInfo&gt;
                                              {
                                                  new CultureInfo("en-US"),
                                                  new CultureInfo("nl")
                                              };
  
                  options.DefaultRequestCulture = new RequestCulture("en-US");
                  options.SupportedCultures = supportedCultures;
                  options.SupportedUICultures = supportedCultures;
              });
  
              services.AddMvc()
                 .AddViewLocalization()
                 .AddDataAnnotationsLocalization(options =&gt;
                 {
                     options.DataAnnotationLocalizerProvider = (type, factory) =&gt;
                     {
                         var assemblyName = new AssemblyName(typeof(SharedResource).GetTypeInfo().Assembly.FullName);
                         return factory.Create("SharedResource", assemblyName.Name);
                     };
                 }).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
  
  }
  
  
  public void Configure(IApplicationBuilder app,
                          IHostingEnvironment env,
                          ILoggerFactory loggerFactory)
  {
      //Localisation
      var locOptions = app.ApplicationServices.GetService&lt;IOptions&lt;RequestLocalizationOptions&gt;&gt;();
      app.UseRequestLocalization(locOptions.Value);
  
      app.UseHttpsRedirection();
      app.UseStaticFiles();
      app.UseAuthentication();
      app.UseSession();
  
      app.UseSession();
      app.UseCookiePolicy();
  }
  </code></pre>
  
  <p>The code in the LocService class is </p>
  
  <pre><code>public class LocService
  {
      private readonly IStringLocalizer _localizer;
  
      public LocService(IStringLocalizerFactory factory)
      {
          var type = typeof(SharedResource);
          var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName);
          _localizer = factory.Create("SharedResource", assemblyName.Name);
      }
  
      public LocalizedString GetLocalizedHtmlString(string key)
      {
          var value= _localizer[key];
          return value;
      }
  }
  </code></pre>
  
  <p>Now on our controller, we can access the localized string as </p>
  
  <pre><code>localizerService.GetLocalizedHtmlString("my_string")
  </code></pre>
  
  <p>Under the "Resources" folder we have following files present</p>
  
  <ol>
  <li>SharedResource.cs </li>
  <li>SharedResource.en-US.resx</li>
  <li>SharedResource.nl.resx</li>
  </ol>
  
  <p>After updating the website from .net core version 2.2 to version 3.1 the values are not getting converted to the selected language. </p>