Hi,
It seems that a subtle bug has arised sometimes after the inital release of version 7; It did not exist in daily development build 7.0.338.0, but it did exist in daily production build 7.0.0.31, and it still exists in version 8.0.0.15.
The question is: Is is possible to somehow avoid the bug, or will I have to wait for ThinkGeo to fix it? :-)
The attached project sets up a simple demo of the bug. The central element is the EditOverlay, which is filled with a simple rectangular shape. A set of textboxes contains the size and position of the feature. Editing the textboxes causes an update of the shape, while dragging the shape causes an update of the textboxes.
Steps to reproduce the bug:
1. Download and run the attached project
2. Click and drag the rectangle a bit
3. Press TAB (to leave the "Center E"-textbox)
This will result in a "KeyNotFoundException" occuring somewhere deep inside MapSuite.Core, as shown by the StackTrace below.
Note: The bug will NOT occur if step 2 is bypassed, and (multiple) changes are made to the size/position textboxes. Only AFTER a dragging operation will consecutive editing of the textbox values trigger the bug.
STACKTRACE:
==========
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at ThinkGeo.MapSuite.Core.GeoCollection`1.get_Item(String key)
at ThinkGeo.MapSuite.Core.InMemoryFeatureSource.WDM=(RectangleShape WTM=, IEnumerable`1 WjM=)
at ThinkGeo.MapSuite.Core.InMemoryFeatureSource.GetFeaturesInsideBoundingBoxCore(RectangleShape boundingBox, IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesForDrawingCore(RectangleShape boundingBox, Double screenWidth, Double screenHeight, IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesForDrawing(RectangleShape boundingBox, Double screenWidth, Double screenHeight, IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.DesktopEdition.EditInteractiveOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.qhM=(GeoCanvas qxM=)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.hRU=(Graphics hhU=, RectangleShape hxU=, Overlay iBU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.chU=(RectangleShape cxU=, RectangleShape dBU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.whU=(RectangleShape wxU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.vBU=(Int32 vRU=, RectangleShape vhU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh(RectangleShape extent, IEnumerable`1 overlays)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh(IEnumerable`1 overlays)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()
at TEST.Mainform.txtBox_Validated(Object sender, EventArgs e) in C:\DATA\utvikling\Solutions\TEST\TEST\Mainform.cs:line 65
at System.Windows.Forms.Control.OnValidated(EventArgs e)
at System.Windows.Forms.Control.PerformControlValidation(Boolean bulkValidation)
at System.Windows.Forms.ContainerControl.ValidateThroughAncestor(Control ancestorControl, Boolean preventFocusChangeOnError)
KeyNotFoundException occured in version 7, also in version 8
Hi Rolf,
Thanks for so detail description, the problem is I cannot download your attachment file succeed. This is a problem in our forum system, too many same name file will cause it cannot be download.
Could you please rename the zip file to some other name just like: 12104.zip etc. and upload again?
Regards,
Don
Hi Rolf,
I have reproduced this issue via your project.
For now, please rebuild index after change the feature in EditShapesLayer for avoid this exception:
map.EditOverlay.EditShapesLayer.InternalFeatures.Clear();
map.EditOverlay.EditShapesLayer.InternalFeatures.Add(rectangle);
map.EditOverlay.EditShapesLayer.BuildIndex();
I am not sure whether it’s a bug but I will let our developer know this issue.
Thanks very much to let us know this problem.
Regards,
Don
Hi Don,
That seems to fix my problem. Thanks!!
Regards,
Rolf Tore
Hi Rolf,
I am glad to hear that solve your problem.
Any question please let us know.
Regards,
Don