I was having some problems opening serialized versions of CadFeatureLayer using version 9, so I thought I would see if the same problem existed in version 10.
To my surprise, the CadFeatureLayer doesn’t appear to be included in the NuGet package. Where has it gone and how do I include it in my project?
As for the version 9 issue, when you serialize a CadFeatureLayer, it appears to try and write all the features out literally, cadFeaturesDumped = true, rather than simply store a file path variable like ShapeFileFeatureLayer does. This serialization appears to cause problems. When you try and open the deserialized layer, we get “an item with the same key has been added” error. Here’s a bit from the stack trace.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value)
at ThinkGeo.MapSuite.Core.CadFeatureLayer.iis=(Dictionary`2 cadFeatureStyles)
at ThinkGeo.MapSuite.Core.CadFeatureLayer.OpenCore()
at ThinkGeo.MapSuite.Core.Layer.Open()