Forum Visual Studio

Error updating packages in Xamarin Studio (OSX)

KarlKoppKarlKopp AUMember ✭✭
edited July 2016 in Visual Studio

Hi all - getting the following error uninstalling packages in Xamarin Studio (beta channel, OSX El Capt). Any ideas or advice would be greatly appreciated!

ERROR [2016-07-28 09:35:25Z]: Could not update Microsoft.Azure.Mobile.Client.
System.ArgumentException: An item with the same key has already been added.
  at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/throwhelper.cs:72 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Insert (System.Collections.Generic.TKey key, System.Collections.Generic.TValue value, Boolean add) [0x0008e] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:336 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (System.Collections.Generic.TKey key, System.Collections.Generic.TValue value) [0x00000] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:192 
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector, IEqualityComparer`1 comparer) [0x0004d] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/System.Core/System/Linq/Enumerable.cs:855 
  at System.Linq.Enumerable.ToDictionary[TSource,TKey] (IEnumerable`1 source, System.Func`2 keySelector, IEqualityComparer`1 comparer) [0x00000] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/System.Core/System/Linq/Enumerable.cs:843 
  at NuGet.VersionUtility.TryGetCompatibleItems[T] (System.Runtime.Versioning.FrameworkName projectFramework, IEnumerable`1 items, IEnumerable`1& compatibleItems) <0x133b50410 + 0x005bd> in <filename unknown>:0 
  at NuGet.ProjectManager.GetCompatibleInstalledItemsForPackage[T] (System.String packageId, IEnumerable`1 items) <0x1340bf220 + 0x000a9> in <filename unknown>:0 
  at NuGet.ProjectManager.GetFilteredAssembliesToDelete (IPackage package) <0x1340bef30 + 0x00095> in <filename unknown>:0 
  at NuGet.ProjectManager.<RemovePackageReferenceFromProject>b__a (IPackage p) <0x1341c5ed0 + 0x0001c> in <filename unknown>:0 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00064] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/System.Core/System/Linq/Enumerable.cs:285 
  at System.Linq.Enumerable+<SelectManyIterator>c__Iterator5`3[TSource,TCollection,TResult].MoveNext () [0x0009a] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/System.Core/System/Linq/Enumerable.cs:472 
  at System.Linq.Enumerable+<ExceptIterator>c__Iterator13`1[TSource].MoveNext () [0x00056] in /private/tmp/source-mono-4.4.0-c7sr1/bockbuild-mono-4.4.0-branch-c7sr1/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/System.Core/System/Linq/Enumerable.cs:787 
  at NuGet.ProjectManager.RemovePackageReferenceFromProject (IPackage package) <0x1340bc840 + 0x00ce1> in <filename unknown>:0 
  at NuGet.ProjectManager.Execute (NuGet.PackageOperation operation) <0x1340bc2d0 + 0x00415> in <filename unknown>:0 
  at NuGet.ProjectManager.Execute (IPackage package, IPackageOperationResolver resolver) <0x1340aacb0 + 0x000cc> in <filename unknown>:0 
  at NuGet.ProjectManager.AddPackageReference (IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) <0x1340aa5a0 + 0x001ca> in <filename unknown>:0 
  at NuGet.ProjectManager.UpdatePackageReferenceCore (IPackage package, Boolean updateDependencies, Boolean allowPrereleaseVersions) <0x1340aa550 + 0x0003f> in <filename unknown>:0 
  at NuGet.ProjectManager.UpdatePackageReference (System.String packageId, System.Func`1 resolvePackage, Boolean updateDependencies, Boolean allowPrereleaseVersions, Boolean targetVersionSetExplicitly) <0x1340a9260 + 0x004ef> in <filename unknown>:0 
  at NuGet.ProjectManager.UpdatePackageReference (System.String packageId, NuGet.SemanticVersion version, Boolean updateDependencies, Boolean allowPrereleaseVersions) <0x1340a9000 + 0x00202> in <filename unknown>:0 
  at MonoDevelop.PackageManagement.MonoDevelopPackageManager.UpdatePackageReference (IPackage package, Boolean updateDependencies, Boolean allowPrereleaseVersions) [0x0000f] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopPackageManager.cs:190 
  at MonoDevelop.PackageManagement.MonoDevelopPackageManager.UpdatePackageReference (IPackage package, IUpdatePackageSettings settings) [0x00000] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopPackageManager.cs:183 
  at MonoDevelop.PackageManagement.MonoDevelopPackageManager.UpdatePackage (IPackage package, MonoDevelop.PackageManagement.UpdatePackageAction updateAction) [0x0000c] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopPackageManager.cs:178 
  at MonoDevelop.PackageManagement.PackageManagementProject.UpdatePackage (IPackage package, MonoDevelop.PackageManagement.UpdatePackageAction updateAction) [0x00000] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProject.cs:161 
  at MonoDevelop.PackageManagement.UpdatePackageAction.ExecuteCore () [0x00031] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackageAction.cs:87 
  at MonoDevelop.PackageManagement.ProcessPackageAction.Execute () [0x00012] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageAction.cs:82 
  at MonoDevelop.PackageManagement.BackgroundPackageActionRunner.RunActionsWithProgressMonitor (MonoDevelop.Core.ProgressMonitor monitor, IList`1 packageActions) [0x00013] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs:147 
  at MonoDevelop.PackageManagement.BackgroundPackageActionRunner.RunActionsWithProgressMonitor (MonoDevelop.PackageManagement.ProgressMonitorStatusMessage progressMessage, IList`1 installPackageActions) [0x00041] in /Users/builder/data/lanes/3541/30f7c18e/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs:115 
Tagged:

Best Answer

Answers

  • KarlKoppKarlKopp AUMember ✭✭

    Bit more on this, if I try to remove I get the same error (an item with the same key has already been added). Also, these libs are marked as "Package needs retargeting". Even if I try to update some libs that are not marked as needing retargeting, I get the same error.

  • MatthewGerberMatthewGerber USMember ✭✭

    I am also seeing this. Has anyone found the problem and fix?

  • mattwardmattward GBMember Xamurai
    edited August 2016

    @MatthewGerber - What NuGet package are you installing?

    Looking at the Microsoft.Azure.Mobile.Client NuGet package and the date of the original post, the "An item with the same key has already been added" error was most likely caused by the older Microsoft.Bcl.Build NuGet package which has an invalid portable class library project which newer versions of NuGet do not like. A workaround for this is to install the latest Microsoft.Bcl.Build NuGet package first before installing another package that depends on it.

  • MatthewGerberMatthewGerber USMember ✭✭

    @mattward I was getting the error when attempting to update any package in my project. A bit of context: I had been using XS Beta for a while until I realized that it pulls down all of the beta versions of the packages. So I reverted the beta package updates, switched back to XS Stable, and restored the packages. At that point, any time I tried to update a package I got the "same key" error. I then switched back to XS Beta and the errors went away. Thoughts?

  • mattwardmattward GBMember Xamurai

    Xamarin Studio beta and stable should have the same behaviour. They should not update to beta NuGet package unless you have a beta package installed.

    Anyway it looks like I have mixed up my NuGet bugs :) The "An item with the same key has already been added" is something I have seen with the stable version of XLabs.Platform since later versions of NuGet do not like the NuGet package.

Sign In or Register to comment.