Bug 51163 - mcs build results in "An item with the same key has already been added"
Summary: mcs build results in "An item with the same key has already been added"
Status: RESOLVED DUPLICATE of bug 51166
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-12-30 22:57 UTC by Neale Ferguson
Modified: 2017-01-02 18:12 UTC (History)
1 user (show)

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


Attachments

Description Neale Ferguson 2016-12-30 22:57:07 UTC
Compiling the following on .NET or with pre-4.8 mcs -

using System;
using System.Collections.Generic;

namespace fail22
{
                        class MainClass
                        {
                                public static void Main (string[] args)
                                {
                                        var persistable = new Dictionary<int[], double>();
                                        persistable.Add(new int[0],1 );
                                        persistable.Add(new int[0], 1);
                                }
                        }
}

results in a clean build and clean execution.

Under 4.8 the build works but the execution results in:

System.ArgumentException: An item with the same key has already been added.
  at System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) [0x0000b] in <1912473ffe6945af9cb4f31c6bf575b9>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) [0x0008e] in <1912473ffe6945af9cb4f31c6bf575b9>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <1912473ffe6945af9cb4f31c6bf575b9>:0 
  at fail22.MainClass.Main (System.String[] args) [0x00020] in <f9c1eaf2944c468e8547a223d2b70277>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: An item with the same key has already been added.
  at System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) [0x0000b] in <1912473ffe6945af9cb4f31c6bf575b9>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) [0x0008e] in <1912473ffe6945af9cb4f31c6bf575b9>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <1912473ffe6945af9cb4f31c6bf575b9>:0 
  at fail22.MainClass.Main (System.String[] args) [0x00020] in <f9c1eaf2944c468e8547a223d2b70277>:0 


Neale
Comment 1 Marek Safar 2017-01-02 18:12:17 UTC

*** This bug has been marked as a duplicate of bug 51166 ***

Note You need to log in before you can comment on or make changes to this bug.