# GetBoundingBox intermittent exception

**URL:** <https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048>\
**Category:** WPF\
**Created:** [August 15, 2011, 4:58pm UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048 "2011-08-15T16:58:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@Thomas2](https://community.thinkgeo.com/u/Thomas2)\
**Post date:** [August 15, 2011, 4:58pm UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/1 "2011-08-15T16:58:30Z")

</div>

Hello,  
  
  
  
I&nbsp;get&nbsp;this&nbsp;exception&nbsp;around&nbsp;~10%&nbsp;of&nbsp;the&nbsp;time&nbsp;I&nbsp;run&nbsp;the&nbsp;application:  
  
  
  
MapSuiteSetup&nbsp;failedSystem.InvalidOperationException:&nbsp;The&nbsp;FeatureSource&nbsp;is&nbsp;not&nbsp;open.&nbsp;&nbsp;&nbsp;Please&nbsp;call&nbsp;the&nbsp;Open&nbsp;method&nbsp;before&nbsp;calling&nbsp;this&nbsp;method.  
  
  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.InMemoryFeatureSource.GetAllFeaturesCore(IEnumerable`1&nbsp;returningColumnNames)  
  
  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.FeatureSource.GetBoundingBoxCore()  
  
  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.FeatureSource.GetBoundingBox()  
  
  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.FeatureLayer.GetBoundingBoxCore()  
  
  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.Layer.GetBoundingBox()  
  
  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.WpfDesktopEdition.LayerOverlay.GetBoundingBoxCore()  
  
  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.WpfDesktopEdition.Overlay.GetBoundingBox()  
  
  
  
This&nbsp;is&nbsp;the&nbsp;code&nbsp;it's&nbsp;running:&nbsp;  
  
totalBoundingBox1&nbsp;=&nbsp;layerOverlayForGraphics.GetBoundingBox();  
  
Where&nbsp;layerOverlayForGraphics&nbsp;is&nbsp;LayerOverlay&nbsp;with&nbsp;3&nbsp;InMemoryLayers&nbsp;added&nbsp;like&nbsp;this:  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers.Add("inmem2",&nbsp;inMemoryLayer2);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers.Add("inmem3",&nbsp;inMemoryLayer3);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers.Add("inmem",&nbsp;inMemoryLayer);  
  
  
  
I&nbsp;then&nbsp;tried&nbsp;opening&nbsp;all&nbsp;of&nbsp;the&nbsp;and&nbsp;still&nbsp;get&nbsp;the&nbsp;same&nbsp;error&nbsp;once&nbsp;in&nbsp;a&nbsp;while  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers[0].Open();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers[1].Open();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers[2].Open();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;totalBoundingBox1&nbsp;=&nbsp;layerOverlayForGraphics.GetBoundingBox();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers[0].Close();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers[1].Close();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerOverlayForGraphics.Layers[2].Close();  
  
  
  
I'm&nbsp;on&nbsp;Map&nbsp;Suite&nbsp;Wpf&nbsp;Desktop&nbsp;Full&nbsp;Edition&nbsp;5.0  
  
any&nbsp;ideas?  
  
  
  
thanks  
  
Thomas  
  
&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:** [August 16, 2011, 10:12am UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/2 "2011-08-16T10:12:01Z")

</div>

Thomas,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;just&nbsp;want&nbsp;to&nbsp;verify&nbsp;if&nbsp;this&nbsp;problem&nbsp;is&nbsp;caused&nbsp;by&nbsp;multi-threading&nbsp;cross&nbsp;calling,&nbsp;so&nbsp;that&nbsp;could&nbsp;you&nbsp;set&nbsp;layerOverlayForGraphics.TileType&nbsp;=&nbsp;TileType.SingleTile;&nbsp;and&nbsp;have&nbsp;another&nbsp;try.&nbsp;Please&nbsp;let&nbsp;me&nbsp;know&nbsp;your&nbsp;testing&nbsp;result.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;James

---

<div class="post-metadata">

**Author:** ![Thomas2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@Thomas2](https://community.thinkgeo.com/u/Thomas2)\
**Post date:** [August 16, 2011, 1:15pm UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/3 "2011-08-16T13:15:32Z")

</div>

James,

Thanks.&nbsp;&nbsp;That&nbsp;seems&nbsp;to&nbsp;fix&nbsp;it.&nbsp;&nbsp;I&nbsp;presume&nbsp;this&nbsp;change&nbsp;impacts&nbsp;performance?&nbsp;&nbsp;What&nbsp;could&nbsp;be&nbsp;causing&nbsp;this?&nbsp;&nbsp;Any&nbsp;other&nbsp;work-arounds?

thanks

Thomas

---

<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:** [August 17, 2011, 9:13am UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/4 "2011-08-17T09:13:37Z")

</div>

Thomas,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;when&nbsp;you&nbsp;use&nbsp;LayerOverlay,&nbsp;the&nbsp;default&nbsp;setting&nbsp;is&nbsp;MultiTile&nbsp;which&nbsp;using&nbsp;multi-threadings,&nbsp;to&nbsp;avoid&nbsp;threading&nbsp;crossing&nbsp;call,&nbsp;you&nbsp;can&nbsp;add&nbsp;lock()&nbsp;block&nbsp;the&nbsp;GetBoundingBox&nbsp;method.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;James

---

<div class="post-metadata">

**Author:** ![Thomas2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@Thomas2](https://community.thinkgeo.com/u/Thomas2)\
**Post date:** [August 17, 2011, 12:28pm UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/5 "2011-08-17T12:28:16Z")

</div>

James,

Thanks.&nbsp;&nbsp;But&nbsp;why&nbsp;is&nbsp;that?&nbsp;&nbsp;I&nbsp;mean&nbsp;it&nbsp;seems&nbsp;to&nbsp;occur&nbsp;only&nbsp;at&nbsp;start&nbsp;of&nbsp;the&nbsp;application.&nbsp;&nbsp;Do&nbsp;I&nbsp;have&nbsp;to&nbsp;lock&nbsp;every&nbsp;time&nbsp;I&nbsp;call&nbsp;that&nbsp;function?

thanks

Thomas

---

<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:** [August 18, 2011, 10:09am UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/6 "2011-08-18T10:09:48Z")

</div>

Thomas,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;the&nbsp;reason&nbsp;that&nbsp;the&nbsp;error&nbsp;only&nbsp;occur&nbsp;at&nbsp;start&nbsp;of&nbsp;the&nbsp;application&nbsp;is&nbsp;that&nbsp;when&nbsp;you&nbsp;start&nbsp;application,&nbsp;it&nbsp;will&nbsp;draw&nbsp;tiles&nbsp;with&nbsp;multi-threading,&nbsp;each&nbsp;tile&nbsp;will&nbsp;open&nbsp;and&nbsp;close&nbsp;layer&nbsp;in&nbsp;worker&nbsp;threading,&nbsp;meanwhile&nbsp;you&nbsp;can&nbsp;layer.GetBoundingBox.&nbsp;After&nbsp;that&nbsp;you&nbsp;call&nbsp;layer.GetBoundingBox&nbsp;after&nbsp;each&nbsp;operation&nbsp;such&nbsp;as&nbsp;pan,&nbsp;zoom&nbsp;in/out&nbsp;finished,&nbsp;you&nbsp;can&nbsp;try&nbsp;to&nbsp;call&nbsp;it&nbsp;during&nbsp;the&nbsp;map&nbsp;drawing,&nbsp;I&nbsp;think&nbsp;it&nbsp;will&nbsp;has&nbsp;the&nbsp;same&nbsp;error.&nbsp;  
&nbsp;&nbsp;  
&nbsp;You&nbsp;don’t&nbsp;need&nbsp;to&nbsp;call&nbsp;that&nbsp;function&nbsp;every&nbsp;time,&nbsp;you&nbsp;can&nbsp;set&nbsp;overlay.LockLayerMode&nbsp;=&nbsp;LockLayerMode.Lock;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;James

---

<div class="post-metadata">

**Author:** ![Thomas2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@Thomas2](https://community.thinkgeo.com/u/Thomas2)\
**Post date:** [August 18, 2011, 4:51pm UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/7 "2011-08-18T16:51:18Z")

</div>

James,

I&nbsp;tried&nbsp;locking&nbsp;on&nbsp;the&nbsp;overlay&nbsp;and&nbsp;it&nbsp;still&nbsp;has&nbsp;the&nbsp;exception&nbsp;sometimes&nbsp;at&nbsp;the&nbsp;start.

I&nbsp;will&nbsp;try&nbsp;overlay.LockLayerMode&nbsp;=&nbsp;LockLayerMode.Lock;

thanks

Thomas

---

<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:** [August 19, 2011, 9:58am UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/8 "2011-08-19T09:58:15Z")

</div>

Thomas,&nbsp;  
  
  
  
Could&nbsp;you&nbsp;try&nbsp;to&nbsp;do&nbsp;like&nbsp;this,&nbsp;override&nbsp;the&nbsp;GetAllFeaturesCore&nbsp;method&nbsp;as&nbsp;following&nbsp;code:

&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;class&nbsp;CustomInMemoryFeatureSource&nbsp;:&nbsp;InMemoryFeatureSource

&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;override&nbsp;Collection\<Feature\>&nbsp;GetAllFeaturesCore(IEnumerable\<string\>&nbsp;returningColumnNames)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collection\<Feature\>&nbsp;returnFeatures&nbsp;=&nbsp;new&nbsp;Collection\<Feature\>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(Feature&nbsp;feature&nbsp;in&nbsp;InternalFeatures)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Feature&nbsp;newFeature&nbsp;=&nbsp;GetClonedFeature(feature,&nbsp;returningColumnNames);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnFeatures.Add(newFeature);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;returnFeatures;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;static&nbsp;Feature&nbsp;GetClonedFeature(Feature&nbsp;feature,&nbsp;IEnumerable\<string\>&nbsp;returningColumnNames)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dictionary\<string,&nbsp;string\>&nbsp;columnValues&nbsp;=&nbsp;new&nbsp;Dictionary\<string,&nbsp;string\>();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(string&nbsp;columnName&nbsp;in&nbsp;returningColumnNames)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(feature.ColumnValues.ContainsKey(columnName))

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;columnValues.Add(columnName,&nbsp;feature.ColumnValues[columnName]);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;columnValues.Add(columnName,&nbsp;string.Empty);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte[]&nbsp;wellKnownBinary&nbsp;=&nbsp;feature.GetWellKnownBinary();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte[]&nbsp;projectedWellKnownBinary&nbsp;=&nbsp;new&nbsp;byte[wellKnownBinary.Length];

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Buffer.BlockCopy(wellKnownBinary,&nbsp;0,&nbsp;projectedWellKnownBinary,&nbsp;0,&nbsp;wellKnownBinary.Length);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Feature&nbsp;insideFeature&nbsp;=&nbsp;new&nbsp;Feature(projectedWellKnownBinary,&nbsp;feature.Id,&nbsp;columnValues);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;insideFeature.Tag&nbsp;=&nbsp;feature.Tag;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;insideFeature;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;}

Thanks,

James

\<string\>\</string\>

---

<div class="post-metadata">

**Author:** ![Thomas2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@Thomas2](https://community.thinkgeo.com/u/Thomas2)\
**Post date:** [August 19, 2011, 12:33pm UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/9 "2011-08-19T12:33:17Z")

</div>

James,

Thanks&nbsp;I&nbsp;will.&nbsp;&nbsp;Am&nbsp;I&nbsp;doing&nbsp;something&nbsp;unusual&nbsp;for&nbsp;this&nbsp;to&nbsp;occur?

thanks

Thomas

---

<div class="post-metadata">

**Author:** ![Thomas2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@Thomas2](https://community.thinkgeo.com/u/Thomas2)\
**Post date:** [August 19, 2011, 4:14pm UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/10 "2011-08-19T16:14:58Z")

</div>

James,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;also&nbsp;sometimes&nbsp;get&nbsp;it&nbsp;when&nbsp;loading&nbsp;a&nbsp;shapefile&nbsp;and&nbsp;getting&nbsp;its&nbsp;bounding&nbsp;box&nbsp;  
&nbsp;&nbsp;  
&nbsp;ShapeFileFeatureLayer&nbsp;x=&nbsp;new&nbsp;ShapeFileFeatureLayer(dlg.FileName);&nbsp;  
&nbsp;…&nbsp;  
&nbsp;rs&nbsp;=&nbsp;x.GetBoundingBox();&nbsp;  
&nbsp;…&nbsp;  
&nbsp;thanks&nbsp;  
&nbsp;Thomas

---

<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:** [August 22, 2011, 9:30am UTC](https://community.thinkgeo.com/t/getboundingbox-intermittent-exception/3048/11 "2011-08-22T09:30:09Z")

</div>

Thomas,&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;code&nbsp;you&nbsp;provided&nbsp;is&nbsp;usual,&nbsp;but&nbsp;I&nbsp;don’t&nbsp;know&nbsp;there&nbsp;is&nbsp;any&nbsp;other&nbsp;unusual&nbsp;code&nbsp;to&nbsp;cause&nbsp;this&nbsp;problem.&nbsp;  
&nbsp;&nbsp;  
&nbsp;About&nbsp;ShapeFileFeatureLayer,&nbsp;I&nbsp;think&nbsp;you&nbsp;get&nbsp;another&nbsp;problem,&nbsp;because&nbsp;GetBoundingBox()&nbsp;of&nbsp;it&nbsp;won’t&nbsp;call&nbsp;GetAllFeatureCore,&nbsp;the&nbsp;stack-trace&nbsp;should&nbsp;be&nbsp;different.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Just&nbsp;keep&nbsp;in&nbsp;communication&nbsp;to&nbsp;figure&nbsp;out&nbsp;the&nbsp;really&nbsp;problem&nbsp;eventually.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;James
