Bug 39152 - `xamarin-component.exe restore` throws System.ArgumentException: An item with the same key has already been added
Summary: `xamarin-component.exe restore` throws System.ArgumentException: An item with...
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Studio Integration ()
Version: N/A
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2016-02-26 07:19 UTC by Prashant Cholachagudda
Modified: 2016-03-02 15:17 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Prashant Cholachagudda 2016-02-26 07:19:08 UTC
The latest xamarin-component.exe from the nuget throws System.ArgumentException when we try to restore the components.
This happens on both Mac and Windows

#Steps to reproduce
1. Create Xamarin project
2. Add any component from the Component store
3. Add XamarinComponent v1.1.0.25 to the project
4. Execute xamarin-component.exe restore .\App1.sln

#Actual Result

The restore command throws an exception - 

The following output and exception then occurs:
INFO (restore): Computed cookie jar path: C:\Users\prashantvc\.xamarin-credentials
INFO (restore): [*] Restoring googleglass v2.1.0
INFO (restore): Downloading googleglass 2.1.0

Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item)
at System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item)
at Mono.Options.OptionSet.InsertItem(Int32 index, Option item)
at Mono.Options.OptionSet.Add(String prototype, String description, Action`1 action, Boolean hidden)
at Xamarin.Components.CheckCommandHandler.GetOptionSet()
at Xamarin.Components.CheckCommandHandler.Invoke(String[] args)
at Xamarin.Components.Utility.RunCheckWorkflowForComponent(ICommandHandler handler, Boolean staging, Boolean development, String id, String version)
at Xamarin.Components.RestoreCommandHandler.DownloadComponentFromServer(String server, String componentId, String componentVersion, Boolean isTrial)
at Xamarin.Components.RestoreCommandHandler.Invoke(String[] args)
at Xamarin.Components.MainClass.Main(String[] args)

# Expected result
The restore command should restore the components in the solution

Note that everything works just fine with v1.1.0.23