ThinkGeo.com    |     Documentation    |     Premium Support

Collection was modified; enumeration operation may not execute

Another exception throw, we are having trouble in tracing:


(it seems rolling back to 3.0.362 makes things quite stable, not sure what has changed that might cause this.. we do run in multi threaded mode?)


 


System.InvalidOperationException was unhandled

  Message="Collection was modified; enumeration operation may not execute."

  Source="mscorlib"

  StackTrace:

       at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)

       at System.Collections.Generic.List`1.Enumerator.MoveNextRare()

       at System.Collections.Generic.List`1.Enumerator.MoveNext()

       at ThinkGeo.MapSuite.Core.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)

       at ThinkGeo.MapSuite.Core.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)

       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.LayerOverlay.DrawCore(GeoCanvas canvas)

       at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)

       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x5021a7a45adbb9ee(Object x3faa3e674cef60b0)

       at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)

       at System.Threading.ExecutionContext.runTryCode(Object userData)

       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)

       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

  InnerException: 



Hi Gordon,


So this exception is raised in the latest versiont 3.0.426, and you change the thread mode to multi threaded mode in your application? Does this exception is raised every time? Have you added the lock code to your application? Could you please supply us some simple sample or some data so that we can recreate this exception?
Any more information is appreciated.
Thanks,
sun