Recently I got an unidentified mysterious problem while trying to call Refresh() method in WinformsMap. Inside WinformsMap there’s only 1 LayerOverlay object consisting of 3 MsSql2008FeatureLayer (all are not empty), 3 InMemoryFeatureLayer (only 1 is used), a scale bar in its AdornmentOverlay, a LegendAdornmentLayer, and an MiniMapAdornmentLayer (taken from official example).
Due to unseparatable files in the project, I couldn’t attach an example to reproduce the error. But here is the screenshot of the exception StackTrace. I couldn’t pinpoint what caused it as in another method, it works flawlessly.
I have found the function at the top of the exception message, but I am sorry I haven’t found possible issue from here.
If possible, could you please do some test like this?
1. Create your customMsSql2008FeatureSource inherit from MsSql2008FeatureSource 2. Override GetFeaturesInsideBoundingBoxCore function, add some monitor code here, or catch exception from base.GetFeaturesInsideBoundingBoxCore() here 3. Create your customMsSql2008FeatureLayer inherit from MsSql2008FeatureLayer, assign the instance to FeatureSource 4. Replace MsSql2008FeatureLayer in your code with the new customMsSql2008FeatureLayer
Now you can get more detail exception information, for example the exception parameter or exception message. They will be helpful for us.
Thank you for your response. I’ve done what you suggested but unfortunately, it brought no additional clue of what happened inside GetFeaturesInsideBoundingBoxCore() method.
And apologize I forget to mention exception’s message was “An item with the same key has already been added.”, so I figure it has to be coming from a private Dictionary (or any Key-Value based IEnumerable) field inside the one of my MsSql2008FeatureLayer object.