damienbod / AspNetCoreLocalization

Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples
http://damienbod.com/2015/10/21/asp-net-5-mvc-6-localization/
MIT License
251 stars 101 forks source link

Exception on GetAllFromDatabaseForResource() #51

Open ondrejdobecka opened 6 years ago

ondrejdobecka commented 6 years ago

Sometimes, when I start asp core 2.1 app, it throws an exception in method GetAllFromDatabaseForResource() in SqlStringLocalizerFactory class.

A second operation started on this context before a previous operation completed. Any instance members are not guaranteed to be thread safe.

Do you have an idea where is problem? Thank you ;)

nehio commented 6 years ago

Hi, somewhere in your app there must be an await missing, and since the LocalisationContext is Singleton someone isnt waiting it's turn.

Have you tried registering as Transient ? This won't solve the problem per se, but it will limit the chance of it happenning