Cannot figure this one out.
Occurs after I clear most layer Items and Zoom out on the map
The Big issue is that it occurs from MSCORLIB and I cannot trap it.
at System.ThrowHelper.ThrowKeyNotFoundException()
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.GetFeaturesBasedOnCachedBoundingBoxes(RectangleShape extent, IEnumerable`1 returningColumnNames)
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.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.MainDraw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x03e3d48bcfe7bb6c(IEnumerable`1 xa6f0db4f183189f1)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xff5b27c00f9678c2(RectangleShape x178b193eec228e6e)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xe3cee4adb9c72451()
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xc8fbf8304fe7558e(InteractionArguments x195facd4ef5d753d)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xfeca3317d3c75bbb(Object xd9272088e65bd176, x6a8380ab1a7ebb4c xc2fd4c0ed406cdb7)
at ThinkGeo.MapSuite.DesktopEdition.x5cd462d41be2f68a.OnMouseEvent(x6a8380ab1a7ebb4c e)
at ThinkGeo.MapSuite.DesktopEdition.x5cd462d41be2f68a.AnalyseMouseWheel(Double screenX, Double screenY, Double worldX, Double worldY, Int32 delta)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xb0cb8571d4771126(Object xd9272088e65bd176, MouseEventArgs xc2fd4c0ed406cdb7)
at System.Windows.Forms.MouseEventHandler.Invoke(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseWheel(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseWheel(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.DoEvents()
at s3fast5._0.Form1.Timer1_Tick(Object sender, EventArgs e) in C:\Users\down\Documents\Visual Studio 2012\Projects\s3fast5 - Copy\s3fast5\Form1.vb:line 578
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at s3fast5._0.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
System Crash during Map Refresh
Hi Steve,
Thank you to report this issue and it proved a bug. Now, we have fixed it in the latest version(7.0.0.170 or 7.0.170.0 might be still building, please waiting for some hours).
Regards,
Johnny
Good to hear.
We are currently running Version 4.5. Can we download this Corrected version?
We just spoke to customer service and It appears that it will cost us 5,000 to download this fix.
Is there any other workaround?
Hi Steve,
There are several workarounds on this issue, just pick up one of them:
- Remove the BuildIndex mthod in your codes or call the method after deleting the features from InMemoryFeatureLayer.
- Defined a custom InMemoryFeatureLayer, codes like the below:
public
class
CustomInMemoryFeatureSource : InMemoryFeatureSource
{
public
CustomInMemoryFeatureSource()
:
base
(
new
FeatureSourceColumn[] { },
new
Feature[] { })
{ }
protected
override
System.Collections.ObjectModel.Collection<Feature> GetFeaturesInsideBoundingBoxCore(RectangleShape boundingBox, IEnumerable<
string
> returningColumnNames)
{
this
.BuildIndex();
return
base
.GetFeaturesInsideBoundingBoxCore(boundingBox, returningColumnNames);
}
}
public
class
CustomInMemoryFeatureLayer : InMemoryFeatureLayer
{
public
CustomInMemoryFeatureLayer()
{
this
.FeatureSource =
new
CustomInMemoryFeatureSource();
}
}
Hope it helps.
Regards,
Johnny
Not quite clear on What you mean.
the code below Will Cause the error on the Maprefresh
AssetLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear()
AssetLayer.InternalFeatures.Clear()
pointLayer.InternalFeatures.Clear()
Try
WinformsMap1.Refresh()
Application.DoEvents()
Catch ex1 As Exception
End Try
My Guess is that you mean to use the above code to define a custom layer type and declare these Feature layers using the new type. Is that correct?
So I attempted to Implement this change
converted to VB
Public Class CustomInMemoryFeatureSource
Inherits InMemoryFeatureSource
Public Sub New()
MyBase.New(New FeatureSourceColumn() {}, New Feature() {})
End Sub
Protected Overrides Function GetFeaturesInsideBoundingBoxCore(boundingBox As RectangleShape, returningColumnNames As IEnumerable(Of String)) As System.Collections.ObjectModel.Collection
Me.BuildIndex()
Return MyBase.GetFeaturesInsideBoundingBoxCore(boundingBox, returningColumnNames)
End Function
End Class
Public Class CustomInMemoryFeatureLayer
Inherits InMemoryFeatureLayer
Public Sub New()
Me.FeatureSource = New CustomInMemoryFeatureSource()
End Sub
End Class
Module modLayers
Public pointLayer As CustomInMemoryFeatureLayer = New CustomInMemoryFeatureLayer() ’ this layer holds all the reading points
Public AssetLayer As CustomInMemoryFeatureLayer = New CustomInMemoryFeatureLayer() ’ this layer holds all the Vehicle Icons
Public MainOverlay As LayerOverlay = New LayerOverlay()
On Build I received an Error.
To few Type arguments to 'System.Collections.ObjectModel.Collection(Of T)
Did I miss Something?
I think I found the Issue
corrected Line.
Protected Overrides Function GetFeaturesInsideBoundingBoxCore(boundingBox As RectangleShape, returningColumnNames As IEnumerable(Of String)) As System.Collections.ObjectModel.Collection(Of ThinkGeo.MapSuite.Core.Feature)
Hi Steve,
Good to hear you figure out the issue.
Regards,
Johnny
Unfortunately the issue is still there.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at ThinkGeo.MapSuite.Core.GeoCollection`1.GetKeys()
at ThinkGeo.MapSuite.Core.InMemoryFeatureSource.BuildIndex()
at s3fast5._0.CustomInMemoryFeatureSource.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.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.MainDraw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x03e3d48bcfe7bb6c(IEnumerable`1 xa6f0db4f183189f1)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xff5b27c00f9678c2(RectangleShape x178b193eec228e6e)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x742ba885258f6c2c(RectangleShape xb35a33b423b17f65, Overlay x99251f66cdabc2ad, Int32 xa209325f5c895f7e, Int32 x7454a0d1965919b1, GeographyUnit xbb704b4400ce6f76)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x88c2a2d6d754e692(IEnumerable`1 xa6f0db4f183189f1)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xe3cee4adb9c72451()
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x4eb49068e137ed8f(InteractionArguments x195facd4ef5d753d)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xfeca3317d3c75bbb(Object xd9272088e65bd176, x6a8380ab1a7ebb4c xc2fd4c0ed406cdb7)
at ThinkGeo.MapSuite.DesktopEdition.x5cd462d41be2f68a.OnMouseEvent(x6a8380ab1a7ebb4c e)
at ThinkGeo.MapSuite.DesktopEdition.x5cd462d41be2f68a.AnalyseMouseUp(Double screenX, Double screenY, Double worldX, Double worldY, MapMouseButton mouseButton)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xd1e58e0ca2447b93(Object xd9272088e65bd176, MouseEventArgs xc2fd4c0ed406cdb7)
at System.Windows.Forms.MouseEventHandler.Invoke(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
and a new error on the me.buildIndex
Protected Overrides Function GetFeaturesInsideBoundingBoxCore(boundingBox As RectangleShape, returningColumnNames As IEnumerable(Of String)) As System.Collections.ObjectModel.Collection(Of ThinkGeo.MapSuite.Core.Feature)
Me.BuildIndex()
Return MyBase.GetFeaturesInsideBoundingBoxCore(boundingBox, returningColumnNames)
End Function
End Class
Failed to compare two elements in the array.
Hi Steve,
From the exception, it seems not the same as the original one. We also test it with 4.5 version but didn’t encounter the exception. I have attached the test sample, would you please check it and do some modifications to recreate your issues?
Thanks,
Johnny
Post11674.zip (1.5 MB)
That was one of several errors we received.
We usually received a bad index or Key error on the updated function on the buildIndex line.
My attempt to fix this was to add a line
Dim rslt As New System.Collections.ObjectModel.Collection(Of ThinkGeo.MapSuite.Core.Feature)
then
Protected Overrides Function GetFeaturesInsideBoundingBoxCore(boundingBox As RectangleShape, returningColumnNames As IEnumerable(Of String)) As System.Collections.ObjectModel.Collection(Of ThinkGeo.MapSuite.Core.Feature)
Try
Me.BuildIndex()
Return MyBase.GetFeaturesInsideBoundingBoxCore(boundingBox, returningColumnNames)
Catch ex As Exception
Return rslt ’ Return the empty result on error
End Try
End Function
End Class
As a side note : This occurs when the datset ( Icons on the map) switches to a large set > 32K icons.
Is there a physical limit?
Hi Steve,
We have tested that adding hundred thousand of features to CustomInMemoryFeatureLayer, but the issue still doesn’t show up.
Codes as follow:
Dim cityLayer As New CustomInMemoryFeatureLayer()
cityLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1
cityLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim ra As New Random()
For i = 0 To 100000
Dim x As Double = ra.NextDouble() * 360 - 180
Dim y As Double = ra.NextDouble() * 180 - 90
cityLayer.InternalFeatures.Add(New Feature(New PointShape(x, y)))
Next
cityLayer.BuildIndex()
Also, could you please try to remove the BuildIndex method in your codes if possible as those issues maybe cause by it. If there is anything we missed, please feel free to tell us.
We still hope you can recreate those issues based on the sample we sent before.
Thanks,
Johnny