Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • kenjin 7 posts 78 karma points
    Oct 20, 2021 @ 01:25
    kenjin
    0

    Error occurred when click on Add language V9.0.1

    I downloaded the source files from https://umbraco.com/products/umbraco-cms/how-to-download-umbraco/ and put it on Visual Studio 2019 for build and run.

    Errors occurred while I was following the tutorial here https://our.umbraco.com/documentation/Tutorials/Creating-Basic-Site/Adding-Language-Variants/. [step 3 Click Add Language]:

    Received an error from the server An error occurred An item with the same key has already been added. Key: pa

    Exception Details System.ArgumentException, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: An item with the same key has already been added. Key: pa Stacktrace at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector) at Umbraco.Cms.Web.BackOffice.Controllers.LanguageController.GetAllCultures() at lambdamethod488(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|250(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

  • Frank Laumann 34 posts 232 karma points
    Oct 20, 2021 @ 06:12
    Frank Laumann
    0

    Hi Kenjin

    I had an error similar to yours. It turned out to be a problem with some of the naming of properties(Edit: property in one of my document types). If you can find the property name that throw the error you might be able to change it and fix it.

    Edit: I'm not saying that there isn't a real problem somewhere in the umbraco code. I just found a workaround by changing the name of a propeerty in one of my document types.

  • kenjin 7 posts 78 karma points
    Oct 20, 2021 @ 07:00
    kenjin
    0

    Hi Frank,

    Thanks for your reply, however, the same thing happened when I start over the project and try to add the language before I create anything. I think it's a big issue.

  • Frank Laumann 34 posts 232 karma points
    Oct 20, 2021 @ 07:55
    Frank Laumann
    0

    Hi Kenjin,

    Okay, is there any reason why you use the source files and not just install with dotnot or any of the other installations methods? I installed a clean version of umbraco 9.0.1 and had no problem with adding a new language.

  • kenjin 7 posts 78 karma points
    Oct 20, 2021 @ 08:45
    kenjin
    1

    Hi Frank,

    This time I used this script to create the project:

    dotnet new umbraco --name MyProject

    So, I think it's the way you mentioned to install the project.

  • Warren Buckley 2106 posts 4789 karma points MVP ∞ admin hq c-trib
    Oct 20, 2021 @ 08:36
    Warren Buckley
    0

    Hi Kenjin,

    As Frank mentions the recommended approach is to use the dotnet new templates to install Umbraco, unless you are intending to work on the source code and contribute a PR back to Umbraco.

    Please try a clean Umbraco 9.0.1 install using the dotnet new approach and see if you can reproduce the problem.

    https://our.umbraco.com/Documentation/Fundamentals/Setup/Install/install-umbraco-with-templates

    If you can reliably reproduce it then please file an issue on the GitHub issue tracker

    https://github.com/umbraco/Umbraco-CMS/issues/new/choose/

    Thanks,
    Warren 😀

  • kenjin 7 posts 78 karma points
    Oct 20, 2021 @ 09:06
    kenjin
    0

    Hi Warren,

    I followed your first link and start all over again step by step but the result is still the same, even this time I connect to SQL Server (first and second time using LocalDB). Anyway, thanks for your reply.

    Errror message

  • Warren Buckley 2106 posts 4789 karma points MVP ∞ admin hq c-trib
    Oct 20, 2021 @ 11:05
    Warren Buckley
    0

    Hi Kenjin

    So can you tell me what language you are trying to add, to see if I can reproduce this as well.

    Cheers,

    Warren

  • Marc Goodson 1630 posts 10773 karma points MVP 6x c-trib
    Oct 20, 2021 @ 11:09
    Marc Goodson
    0

    Where does Umbraco get the list of languages to display in the dropdown from?

    is it from those installed on the server?

    In this instance that list contains a duplicate culture code of 'pa' by the look of it!

    We had similar issue last night, on a site deployed to IIS, but locally (same database) it was ok to add languages, but the error was in listing out the languages... of course as we now have successfully added to them to the project... haven't delved any further... but thought I'd add here in case it helps...

    regards

    Marc

  • Jeavon Leopold 3020 posts 13306 karma points MVP 8x admin c-trib
    Oct 20, 2021 @ 11:16
    Jeavon Leopold
    0

    Can add to this that the language list doesn't load on IIS on Server 2012R2, possibly something related to https://github.com/umbraco/Umbraco-CMS/pull/11276 Haven't had a chance to investigate further, sorry!

  • kenjin 7 posts 78 karma points
    Oct 21, 2021 @ 03:44
    kenjin
    0

    Hi Warren,

    Actually, I just click on the "Add language" button and the error happened, I have no luck selecting the language as well.

    Click on Add language button: Click on Add language button

    Error occurred: Error occurred

    No language for select: No language for me to choose

    Regards,

    Thanks a lot

  • Frank Laumann 34 posts 232 karma points
    Oct 21, 2021 @ 05:59
    Frank Laumann
    0

    If you set up a freshly install of umbraco and push it to github or another repo hosting I could check if it is something wrong with the installation.

    Best regards Frank

  • Warren Buckley 2106 posts 4789 karma points MVP ∞ admin hq c-trib
    Oct 21, 2021 @ 07:26
    Warren Buckley
    1

    Hi Keniin

    Thanks for the information, I would be curious to know more about your machine please.

    What OS are you using with a version number and what language is the computer set to use ?

    As reading Marc's & Jeavon's comment it seems they are having very similar issues when the site is run from a Windows.

    Cheers Warren 😀

  • kenjin 7 posts 78 karma points
    Oct 21, 2021 @ 07:55
    kenjin
    0

    Hi Warren

    I'm using Windows 10 Enterprise LTSC ver1607 build 14393.4651, the language is Hong Kong SAR (Traditional Chinese)

    Thanks & Cheers Kenjin

  • Frank Laumann 34 posts 232 karma points
    Oct 21, 2021 @ 08:23
    Frank Laumann
    1

    Is it possible for you to change language to english on your machine and test again ?

    Best regards Frank

  • kenjin 7 posts 78 karma points
    Oct 22, 2021 @ 06:46
    kenjin
    0

    Hi Frank,

    I grabbed a laptop with Windows 10 Enterprise LTSC ver1809 build 17763.2183, the language in Hong Kong SAR (Traditional Chinese) and it works fine! I think the problem was caused by the Windows version. Can't believe that.

    Regards Kenjin

  • Marc Goodson 1630 posts 10773 karma points MVP 6x c-trib
    Oct 22, 2021 @ 08:22
    Marc Goodson
    1

    What I'm intrigued about is the error message...

    An item with the same key has already been added. Key: pa

    ... what in infers to me, is something is looping through the available languages (presume from windows) and adding each language to a dictionary, perhaps with the key matching the culture name?

    The error is happening when it goes to add a language with key 'pa', but one has already been added with that key and blows up the dictionary...

    But looking at ISO language codes: https://docwiki.embarcadero.com/RADStudio/Sydney/en/LanguageCultureNames,Codes,andISOValues

    I can only see 'punjabi-India' code: pa-IN that contains 'pa', but perhaps there is something else in your machine, that is returning an additional pa.

    The way to check would be to call CultureInfo.GetCultures(CultureTypes.AllCultures) on the errant machine and see if you get a duplicate 'pa'!

    The fix would then be here in Umbraco:

    https://github.com/umbraco/Umbraco-CMS/blob/5bfab13dc5a268714aad2426a2b68ab5561a6407/src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs#L53

    it's calling ToDictionary on the results of GetCultures so will blow up if there are any duplicates or clashing culture code names on the server or machine it is installed on! Would just need to filter out duplicates first.

    regards

    Marc

  • Warren Buckley 2106 posts 4789 karma points MVP ∞ admin hq c-trib
    Oct 22, 2021 @ 08:34
    Warren Buckley
    101

    OK Marc & Kenjin Looks like Bjarke has been debugging this with you over on the GitHub issue tracker and has put a fix in place.

    https://github.com/umbraco/Umbraco-CMS/issues/11427

    https://github.com/umbraco/Umbraco-CMS/pull/11441

  • Marc Goodson 1630 posts 10773 karma points MVP 6x c-trib
    Oct 22, 2021 @ 10:19
    Marc Goodson
    0

    ahh, thanks Warren, looks like I was right too!

  • Pavel 5 posts 86 karma points
    1 week ago
    Pavel
    0

    Hi I have a question about the described problem. I have Umbraco version 9.1.1 installed on the web hosting provider. (IIS on Windows server) and the described error manifests itself in a different way. enter image description here

    Where is the problem on the provider or umbraco? Is the described fix already applied or will it be in the next version?

    enter image description here

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft