ThinkGeo Team,
I’m getting the below ThrowKeyNotFoundException. This only occurs when the application is first started. I’m using a ValueStyle Override for DrawCore. This was first implemented years ago under V10.5, V10.6, and V12.1.0. This has always worked fine and there have been no code changes.
There doesn’t seem to be any issue with the data.
To avoid the Exceptions have recoded as shown below.
I will email you the code and the layer.
I should note that this always occurs once at startup on various features. And it’s only one feature at startup and none of the other 869 Features in the layer. Must be a timing issue.
Thanks,
Dennis
From: TheColumnValue = OneFeature.ColumnValues[this.ColumnName].Trim();
To: bOutCome = OneFeature.ColumnValues.TryGetValue(this.ColumnName, out TheColumnValue);
2025-03-21 09:42:04,738 ERROR OriStarVision - OriStarThinkGeoClasses->OriStarDefaultValueStyle.DrawCore:
Unable to OneFeature.ColumnValues.TryGetValue
LayerName=CookCountyBoundary, FeatureId=19, IsGeometryValid=True, ColumnName=MUNI
2025-03-20 19:22:11,973 ERROR OriStarVision - OriStarVision->UnKnown.FeatureLayer_DrawingException:
LayerName=CookCountyBoundary
Source=System.Private.CoreLib
TargetSite=Void ThrowKeyNotFoundException[T](T)
StackTrace= at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at OriStarThinkGeoClasses.OriStarDefaultValueStyle.DrawCore(IEnumerable`1 TheFeatures, GeoCanvas TheCanvas, Collection`1 TheLabelsInThisLayer, Collection`1 TheLabelsInAllLayers) in C:\OriStarMappingIncThinkGeoUI-V14.3.0\OriStarThinkGeoClasses\OriStarDefaultValueStyle.cs:line 78
at ThinkGeo.Core.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)
at ThinkGeo.Core.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.Core.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.Core.ShapeFileFeatureLayer.mCQ=(GeoCanvas canvas, RectangleShape drawingExtent, Collection`1 labelsInAllLayers, ZoomLevel currentZoomLevel, Collection`1 columnNames, ShapeFileFeatureSource shapeFileFeatureSource, Collection`1 idsToDraw)
at ThinkGeo.Core.ShapeFileFeatureLayer.lyQ=(GeoCanvas canvas, RectangleShape marginWorldExtent, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers, ZoomLevel currentZoomLevel, Collection`1 columnNames, ShapeFileFeatureSource shapeFileFeatureSource, Collection`1 smallBoxes, Collection`1 ids)
at ThinkGeo.Core.ShapeFileFeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.Core.Layer.ZSA=(GeoCanvas canvas, Collection`1 labelsInAllLayers)
Message=The given key 'MUNI' was not present in the dictionary.
2025-03-20 19:22:11,973 ERROR OriStarVision - OriStarVision->MapOverlay.TheLayerOverlay_DrawingException:
LayerOverlay=StreetsCity
Source=System.Private.CoreLib
TargetSite=Void ThrowKeyNotFoundException[T](T)
StackTrace= at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at OriStarThinkGeoClasses.OriStarDefaultValueStyle.DrawCore(IEnumerable`1 TheFeatures, GeoCanvas TheCanvas, Collection`1 TheLabelsInThisLayer, Collection`1 TheLabelsInAllLayers) in C:\OriStarMappingIncThinkGeoUI-V14.3.0\OriStarThinkGeoClasses\OriStarDefaultValueStyle.cs:line 78
at ThinkGeo.Core.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)
at ThinkGeo.Core.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.Core.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.Core.ShapeFileFeatureLayer.mCQ=(GeoCanvas canvas, RectangleShape drawingExtent, Collection`1 labelsInAllLayers, ZoomLevel currentZoomLevel, Collection`1 columnNames, ShapeFileFeatureSource shapeFileFeatureSource, Collection`1 idsToDraw)
at ThinkGeo.Core.ShapeFileFeatureLayer.lyQ=(GeoCanvas canvas, RectangleShape marginWorldExtent, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers, ZoomLevel currentZoomLevel, Collection`1 columnNames, ShapeFileFeatureSource shapeFileFeatureSource, Collection`1 smallBoxes, Collection`1 ids)
at ThinkGeo.Core.ShapeFileFeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.Core.Layer.ZSA=(GeoCanvas canvas, Collection`1 labelsInAllLayers)
Message=The given key 'MUNI' was not present in the dictionary.
2025-03-20 19:22:11,982 ERROR OriStarVision - OriStarVision->UnKnown.FeatureLayer_DrawnException:
LayerName=CookCountyBoundary
Source=System.Private.CoreLib
TargetSite=Void ThrowKeyNotFoundException[T](T)
StackTrace= at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at OriStarThinkGeoClasses.OriStarDefaultValueStyle.DrawCore(IEnumerable`1 TheFeatures, GeoCanvas TheCanvas, Collection`1 TheLabelsInThisLayer, Collection`1 TheLabelsInAllLayers) in C:\OriStarMappingIncThinkGeoUI-V14.3.0\OriStarThinkGeoClasses\OriStarDefaultValueStyle.cs:line 78
at ThinkGeo.Core.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)
at ThinkGeo.Core.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.Core.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.Core.ShapeFileFeatureLayer.mCQ=(GeoCanvas canvas, RectangleShape drawingExtent, Collection`1 labelsInAllLayers, ZoomLevel currentZoomLevel, Collection`1 columnNames, ShapeFileFeatureSource shapeFileFeatureSource, Collection`1 idsToDraw)
at ThinkGeo.Core.ShapeFileFeatureLayer.lyQ=(GeoCanvas canvas, RectangleShape marginWorldExtent, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers, ZoomLevel currentZoomLevel, Collection`1 columnNames, ShapeFileFeatureSource shapeFileFeatureSource, Collection`1 smallBoxes, Collection`1 ids)
at ThinkGeo.Core.ShapeFileFeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.Core.Layer.ZSA=(GeoCanvas canvas, Collection`1 labelsInAllLayers)
Message=The given key 'MUNI' was not present in the dictionary.