Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicates #22

Open
aristotelos opened this issue Apr 18, 2014 · 1 comment
Open

Duplicates #22

aristotelos opened this issue Apr 18, 2014 · 1 comment

Comments

@aristotelos
Copy link

On initializing OpenDDR, a number of duplicate definitions will throw the following catched exceptions.

System.ArgumentException       3    An item with the same key has already been added.      System.ThrowHelper.ThrowArgumentException(System.ExceptionResource)
   System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Insert(System.__Canon, System.__Canon, Boolean)
   System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Add(System.__Canon, System.__Canon)
   Oddr.Documenthandlers.DeviceDatasourceParser.Parse()

System.ArgumentException       1    Item has already been added. Key in dictionary: 'HUAWEI C8812' Key being added: 'HUAWEI C8812'     System.Collections.Hashtable.Insert(System.Object, System.Object, Boolean)
   System.Collections.Specialized.OrderedDictionary.Add(System.Object, System.Object)
   Oddr.Builders.Devices.AndroidDeviceBuilder.PutDevice(System.String, System.Collections.Generic.List`1)

System.ArgumentException       1    Item has already been added. Key in dictionary: 'LG-P936' Key being added: 'LG-P936'       System.Collections.Hashtable.Insert(System.Object, System.Object, Boolean)
   System.Collections.Specialized.OrderedDictionary.Add(System.Object, System.Object)
   Oddr.Builders.Devices.AndroidDeviceBuilder.PutDevice(System.String, System.Collections.Generic.List`1)

System.ArgumentException       1    Item has already been added. Key in dictionary: 'SGH-T889' Key being added: 'SGH-T889'     System.Collections.Hashtable.Insert(System.Object, System.Object, Boolean)
   System.Collections.Specialized.OrderedDictionary.Add(System.Object, System.Object)
   Oddr.Builders.Devices.AndroidDeviceBuilder.PutDevice(System.String, System.Collections.Generic.List`1)

System.ArgumentException       1    Item has already been added. Key in dictionary: 'MB870' Key being added: 'MB870'       System.Collections.Hashtable.Insert(System.Object, System.Object, Boolean)
   System.Collections.Specialized.OrderedDictionary.Add(System.Object, System.Object)
   Oddr.Builders.Devices.AndroidDeviceBuilder.PutDevice(System.String, System.Collections.Generic.List`1)

System.ArgumentException       28       An item with the same key has already been added.      System.ThrowHelper.ThrowArgumentException(System.ExceptionResource)
   System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Insert(System.__Canon, System.__Canon, Boolean)
   System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Add(System.__Canon, System.__Canon)
   Oddr.Builders.Devices.TwoStepDeviceBuilder.PutDevice(System.String, System.Collections.Generic.List`1)

System.ArgumentException       1    Item has already been added. Key in dictionary: 'XT937C' Key being added: 'XT937C'     System.Collections.Hashtable.Insert(System.Object, System.Object, Boolean)
   System.Collections.Specialized.OrderedDictionary.Add(System.Object, System.Object)
   Oddr.Builders.Devices.AndroidDeviceBuilder.PutDevice(System.String, System.Collections.Generic.List`1)
@esjr
Copy link

esjr commented Apr 18, 2014

Hi,
it does appear the 1.27 device data contains duplicates which cause these breaking errors in the .Net version of the OpenDDR code.
However, apart from that there is another issue with the .Net code that 'breaks' things in a much more fundamental way : OrderedTokenDeviceBuilder, inherited by all DeviceBuilders, works because of a bug in .Net up to version 3.5 : OrderedDictionary's enumerator did not throw an InvalidOperationException if the collection was modified while enumerating, which OrderedTokenDeviceBuilder does.
Details : https://stackoverflow.com/questions/5159289/ordereddictionary-breaking-change-in-net-4
and
https://connect.microsoft.com/VisualStudio/feedback/details/384059/ordereddictionary-enumerator-doesnt-throw-invalidoperationexception-after-collection-was-changed

Because this bug is fixed the .Net version of the OpenDDR code will not run on versions after 3.5.
Allow me to point you to Apache's DeviceMap Project (http://incubator.apache.org/devicemap/)
(I am a contributor there and wrote the .Net versions) to which OpenDDR also contribute.
The code there uses the same data, is radically different, has no dependency, is much smaller and several orders of magnitude faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants