# The given key was not present in the dictionary

**URL:** <https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520>\
**Category:** WinForms\
**Created:** [December 1, 2010, 11:27am UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520 "2010-12-01T11:27:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![David9](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/david9/32/24954_2.png) [@David9](https://community.thinkgeo.com/u/David9)\
**Post date:** [December 1, 2010, 11:27am UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/1 "2010-12-01T11:27:51Z")

</div>

&nbsp;I&nbsp;get&nbsp;this&nbsp;exception&nbsp;frequently&nbsp;(but&nbsp;not&nbsp;always)&nbsp;when&nbsp;calling&nbsp;Map.Refresh()&nbsp;or&nbsp;when&nbsp;zooming&nbsp;or&nbsp;resizing.&nbsp;This&nbsp;can&nbsp;happen&nbsp;and&nbsp;then&nbsp;during&nbsp;the&nbsp;next&nbsp;run&nbsp;(with&nbsp;no&nbsp;code&nbsp;changes)&nbsp;it&nbsp;might&nbsp;not&nbsp;happen.

What&nbsp;causes&nbsp;this?&nbsp;What&nbsp;dictionary?

Dave

&nbsp;

&nbsp;

&nbsp;&nbsp;&nbsp;at&nbsp;System.Collections.Generic.Dictionary`2.get\_Item(TKey&nbsp;key)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.GdiPlusRasterSource.GetTemplateBitmap(Int32&nbsp;tempReturnWidth)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.GdiPlusRasterSource.GetImageCore(RectangleShape&nbsp;worldExtent,&nbsp;Int32&nbsp;canvasWidth,&nbsp;Int32&nbsp;canvasHeight)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.RasterSource.GetImage(RectangleShape&nbsp;worldExtent,&nbsp;Int32&nbsp;canvasWidth,&nbsp;Int32&nbsp;canvasHeight)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.RasterLayer.DrawCore(GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInAllLayers)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInAllLayers)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas&nbsp;canvas)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.Overlay.MainDraw(GeoCanvas&nbsp;canvas)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas&nbsp;canvas)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x03e3d48bcfe7bb6c(IEnumerable`1&nbsp;xa6f0db4f183189f1)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xff5b27c00f9678c2(RectangleShape&nbsp;x178b193eec228e6e)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xe3cee4adb9c72451()

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32&nbsp;xb565f4681f05557a)

&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()

&nbsp;&nbsp;&nbsp;\<snip\>

&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [December 1, 2010, 9:18pm UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/2 "2010-12-01T21:18:35Z")

</div>

David,

I&nbsp;test&nbsp;GdiPlusRasterLayer&nbsp;as&nbsp;following&nbsp;code,&nbsp;it&nbsp;works&nbsp;properly.&nbsp;Could&nbsp;you&nbsp;try&nbsp;it&nbsp;at&nbsp;your&nbsp;machine?

`        private void LoadAGeoTiffImage_Load(object sender, EventArgs e)        {            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);            GdiPlusRasterLayer worldImageLayer = new GdiPlusRasterLayer(@"C:\test.tif", new RectangleShape(-180, 90, 180, -90));            worldImageLayer.UpperThreshold = double.MaxValue;            worldImageLayer.LowerThreshold = 0;            worldImageLayer.IsGrayscale = false;            LayerOverlay ImageOverlay = new LayerOverlay();            ImageOverlay.Layers.Add("WorldImageLayer", worldImageLayer);            winformsMap1.Overlays.Add(ImageOverlay);            worldImageLayer.Open();            winformsMap1.CurrentExtent = worldImageLayer.GetBoundingBox();            worldImageLayer.Close();            winformsMap1.Refresh();        }`

Thanks

James

---

<div class="post-metadata">

**Author:** ![David9](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/david9/32/24954_2.png) [@David9](https://community.thinkgeo.com/u/David9)\
**Post date:** [December 2, 2010, 11:11pm UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/3 "2010-12-02T23:11:01Z")

</div>

Yes,&nbsp;that&nbsp;is&nbsp;the&nbsp;way&nbsp;I&nbsp;am&nbsp;going&nbsp;it...&nbsp;&nbsp;let's&nbsp;try&nbsp;this&nbsp;the&nbsp;other&nbsp;way...&nbsp;&nbsp;please&nbsp;load&nbsp;this&nbsp;image&nbsp;and&nbsp;worldfile&nbsp;and&nbsp;see&nbsp;if&nbsp;you&nbsp;can&nbsp;pan&nbsp;and&nbsp;zoom&nbsp;repeatedly&nbsp;a&nbsp;dozen&nbsp;times&nbsp;or&nbsp;so&nbsp;without&nbsp;an&nbsp;error.

I&nbsp;would&nbsp;still&nbsp;like&nbsp;to&nbsp;know&nbsp;what&nbsp;dictionary&nbsp;the&nbsp;error&nbsp;is&nbsp;talking&nbsp;about...&nbsp;I&nbsp;am&nbsp;not&nbsp;aware&nbsp;of&nbsp;any&nbsp;dictionaries&nbsp;in&nbsp;my&nbsp;code...

&nbsp;  
Dave  
  
[Buchanan\_sat.txt](https://community.thinkgeo.com/uploads/default/original/2X/b/bde630f8f369946f45d46939a00d6c1c27ae5457.txt) (127 Bytes)

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [December 2, 2010, 11:59pm UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/4 "2010-12-02T23:59:28Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;maybe&nbsp;it’s&nbsp;a&nbsp;protential&nbsp;bug,&nbsp;but&nbsp;even&nbsp;I&nbsp;use&nbsp;your&nbsp;world&nbsp;file&nbsp;instead&nbsp;of&nbsp;pass&nbsp;in&nbsp;a&nbsp;rectangleShape,&nbsp;it&nbsp;still&nbsp;doesn’t&nbsp;throw&nbsp;exception&nbsp;while&nbsp;I&nbsp;pan&nbsp;or&nbsp;zoom&nbsp;in/out&nbsp;many&nbsp;times.&nbsp;So&nbsp;I&nbsp;think&nbsp;maybe&nbsp;the&nbsp;special&nbsp;environment&nbsp;caused&nbsp;this&nbsp;problem,&nbsp;Could&nbsp;you&nbsp;provide&nbsp;more&nbsp;information,&nbsp;such&nbsp;as&nbsp;your&nbsp;system,&nbsp;your&nbsp;language&nbsp;and&nbsp;which&nbsp;version&nbsp;of&nbsp;MapSuite&nbsp;you&nbsp;using?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;  
&nbsp;James

---

<div class="post-metadata">

**Author:** ![Nicole](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/258eb7/32.png) [@Nicole](https://community.thinkgeo.com/u/Nicole)\
**Post date:** [February 3, 2011, 8:59am UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/5 "2011-02-03T08:59:58Z")

</div>

James,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;am&nbsp;seeing&nbsp;exactly&nbsp;the&nbsp;same&nbsp;exception&nbsp;using&nbsp;version&nbsp;4.5.&nbsp;&nbsp;Is&nbsp;there&nbsp;any&nbsp;additonal&nbsp;information&nbsp;available&nbsp;concerning&nbsp;the&nbsp;problem?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Nicole

---

<div class="post-metadata">

**Author:** ![Ryan](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@Ryan](https://community.thinkgeo.com/u/Ryan)\
**Post date:** [February 3, 2011, 10:30am UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/6 "2011-02-03T10:30:48Z")

</div>

Nicole,&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;It&nbsp;seems&nbsp;that&nbsp;we&nbsp;have&nbsp;not&nbsp;been&nbsp;able&nbsp;to&nbsp;recreate&nbsp;the&nbsp;issue&nbsp;in&nbsp;our&nbsp;environment.&nbsp;Could&nbsp;you&nbsp;provide&nbsp;more&nbsp;information,&nbsp;such&nbsp;as&nbsp;your&nbsp;operating&nbsp;system,&nbsp;your&nbsp;language,&nbsp;version&nbsp;of&nbsp;the&nbsp;.NET&nbsp;Framework&nbsp;installed.&nbsp;Perhaps&nbsp;provide&nbsp;a&nbsp;small&nbsp;sample&nbsp;application&nbsp;that&nbsp;shows&nbsp;the&nbsp;code&nbsp;you&nbsp;are&nbsp;using&nbsp;and&nbsp;can&nbsp;recreate&nbsp;the&nbsp;issue?

---

<div class="post-metadata">

**Author:** ![Ryan](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@Ryan](https://community.thinkgeo.com/u/Ryan)\
**Post date:** [February 3, 2011, 10:31am UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/7 "2011-02-03T10:31:01Z")

</div>

Nicole,&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;It&nbsp;seems&nbsp;that&nbsp;we&nbsp;have&nbsp;not&nbsp;been&nbsp;able&nbsp;to&nbsp;recreate&nbsp;the&nbsp;issue&nbsp;in&nbsp;our&nbsp;environment.&nbsp;Could&nbsp;you&nbsp;provide&nbsp;more&nbsp;information,&nbsp;such&nbsp;as&nbsp;your&nbsp;operating&nbsp;system,&nbsp;your&nbsp;language,&nbsp;version&nbsp;of&nbsp;the&nbsp;.NET&nbsp;Framework&nbsp;installed?&nbsp;Perhaps&nbsp;provide&nbsp;a&nbsp;small&nbsp;sample&nbsp;application&nbsp;that&nbsp;shows&nbsp;the&nbsp;code&nbsp;you&nbsp;are&nbsp;using&nbsp;and&nbsp;can&nbsp;recreate&nbsp;the&nbsp;issue?

---

<div class="post-metadata">

**Author:** ![Nicole](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/258eb7/32.png) [@Nicole](https://community.thinkgeo.com/u/Nicole)\
**Post date:** [February 3, 2011, 12:29pm UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/8 "2011-02-03T12:29:01Z")

</div>

Ryan,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Is&nbsp;there&nbsp;an&nbsp;e-mail&nbsp;address&nbsp;to&nbsp;which&nbsp;I&nbsp;can&nbsp;send&nbsp;a&nbsp;sample&nbsp;application?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Nicole

---

<div class="post-metadata">

**Author:** ![Ryan](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@Ryan](https://community.thinkgeo.com/u/Ryan)\
**Post date:** [February 3, 2011, 2:08pm UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/9 "2011-02-03T14:08:40Z")

</div>

Nicole,

The&nbsp;best&nbsp;way&nbsp;to&nbsp;do&nbsp;this&nbsp;would&nbsp;be&nbsp;to&nbsp;create&nbsp;a&nbsp;Ticket&nbsp;in&nbsp;our&nbsp;Customer&nbsp;Portal&nbsp;located&nbsp;at&nbsp;[helpdesk.thinkgeo.com](http://helpdesk.thinkgeo.com).&nbsp;The&nbsp;ticket&nbsp;system&nbsp;has&nbsp;the&nbsp;ability&nbsp;to&nbsp;accept&nbsp;uploads&nbsp;and&nbsp;will&nbsp;keep&nbsp;your&nbsp;code&nbsp;in&nbsp;a&nbsp;location&nbsp;that&nbsp;only&nbsp;you&nbsp;and&nbsp;our&nbsp;enginneers&nbsp;can&nbsp;access.

---

<div class="post-metadata">

**Author:** ![Nicole](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/258eb7/32.png) [@Nicole](https://community.thinkgeo.com/u/Nicole)\
**Post date:** [February 3, 2011, 2:34pm UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/10 "2011-02-03T14:34:06Z")

</div>

Ryan,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I’ve&nbsp;created&nbsp;the&nbsp;ticket.&nbsp;&nbsp;It’s&nbsp;#3332.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Nicole

---

<div class="post-metadata">

**Author:** ![Nicole](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/258eb7/32.png) [@Nicole](https://community.thinkgeo.com/u/Nicole)\
**Post date:** [February 4, 2011, 8:23am UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/11 "2011-02-04T08:23:47Z")

</div>

Ryan,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Upgrading&nbsp;to&nbsp;4.5.94.0&nbsp;(as&nbsp;per&nbsp;recommendation&nbsp;in&nbsp;ticket&nbsp;3332&nbsp;response)&nbsp;did&nbsp;indeed&nbsp;fix&nbsp;the&nbsp;problem.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Nicole

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [February 4, 2011, 9:57am UTC](https://community.thinkgeo.com/t/the-given-key-was-not-present-in-the-dictionary/1520/12 "2011-02-04T09:57:25Z")

</div>

Nicole,&nbsp;  
&nbsp;&nbsp;  
&nbsp;If&nbsp;you&nbsp;still&nbsp;have&nbsp;any&nbsp;other&nbsp;questions&nbsp;please&nbsp;let&nbsp;us&nbsp;know,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Scott,
