# FeatureSource Not open when using projections?

**URL:** <https://community.thinkgeo.com/t/featuresource-not-open-when-using-projections/3316>\
**Category:** WPF\
**Created:** [October 15, 2012, 7:34am UTC](https://community.thinkgeo.com/t/featuresource-not-open-when-using-projections/3316 "2012-10-15T07:34:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/5f9b8f/32.png) [@Thomas1](https://community.thinkgeo.com/u/Thomas1)\
**Post date:** [October 15, 2012, 7:34am UTC](https://community.thinkgeo.com/t/featuresource-not-open-when-using-projections/3316/1 "2012-10-15T07:34:32Z")

</div>

&nbsp;I&nbsp;have&nbsp;an&nbsp;application&nbsp;that&nbsp;will&nbsp;parse&nbsp;a&nbsp;kml&nbsp;stream&nbsp;and&nbsp;display&nbsp;it&nbsp;to&nbsp;the&nbsp;user.&nbsp;&nbsp;This&nbsp;kml&nbsp;stream&nbsp;is&nbsp;processed&nbsp;on&nbsp;a&nbsp;separate&nbsp;thread&nbsp;and&nbsp;updated&nbsp;via&nbsp;a&nbsp;timer.&nbsp;&nbsp;I've&nbsp;provided&nbsp;the&nbsp;user&nbsp;with&nbsp;the&nbsp;ability&nbsp;to&nbsp;click&nbsp;on&nbsp;the&nbsp;map&nbsp;and&nbsp;get&nbsp;a&nbsp;popup&nbsp;for&nbsp;the&nbsp;features&nbsp;beneath.&nbsp;&nbsp;I&nbsp;am&nbsp;using&nbsp;locks&nbsp;in&nbsp;the&nbsp;appropriate&nbsp;locations&nbsp;and&nbsp;I&nbsp;have&nbsp;verified&nbsp;my&nbsp;code&nbsp;is&nbsp;thread&nbsp;safe&nbsp;to&nbsp;the&nbsp;best&nbsp;of&nbsp;my&nbsp;ability.&nbsp;&nbsp;The&nbsp;code&nbsp;works&nbsp;as&nbsp;expected&nbsp;when&nbsp;my&nbsp;base&nbsp;map&nbsp;is&nbsp;unprojected.&nbsp;&nbsp;However,&nbsp;when&nbsp;I&nbsp;switch&nbsp;to&nbsp;a&nbsp;projected&nbsp;basemap&nbsp;(ie&nbsp;Google&nbsp;Maps),&nbsp;I&nbsp;will&nbsp;get&nbsp;a&nbsp;featuresource&nbsp;not&nbsp;open&nbsp;exception&nbsp;when&nbsp;the&nbsp;user&nbsp;clicks&nbsp;on&nbsp;the&nbsp;map&nbsp;to&nbsp;get&nbsp;a&nbsp;popup&nbsp;when&nbsp;a&nbsp;kml&nbsp;refresh&nbsp;is&nbsp;occuring.&nbsp;&nbsp;The&nbsp;main&nbsp;problem&nbsp;with&nbsp;this&nbsp;exception&nbsp;is&nbsp;it&nbsp;is&nbsp;unhandled&nbsp;by&nbsp;code&nbsp;and&nbsp;will&nbsp;crash&nbsp;my&nbsp;application.

Is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;override&nbsp;the&nbsp;layer&nbsp;class&nbsp;to&nbsp;catch&nbsp;this&nbsp;exception&nbsp;so&nbsp;it&nbsp;does&nbsp;not&nbsp;crash&nbsp;my&nbsp;application?

Below&nbsp;is&nbsp;the&nbsp;exception:

The&nbsp;FeatureSource&nbsp;is&nbsp;not&nbsp;open.&nbsp;Please&nbsp;call&nbsp;the&nbsp;Open&nbsp;method&nbsp;before&nbsp;calling&nbsp;this&nbsp;method.&nbsp;Type&nbsp;=&nbsp;System.InvalidOperationException&nbsp;Source&nbsp;=&nbsp;WpfDesktopEdition&nbsp;at&nbsp;ThinkGeo.MapSuite.WpfDesktopEdition.Tile.\<\>c\_\_DisplayClass2.\<DrawException\>b\_\_0()&nbsp;at&nbsp;System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate&nbsp;callback,&nbsp;Object&nbsp;args,&nbsp;Int32&nbsp;numArgs)&nbsp;at&nbsp;MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object&nbsp;source,&nbsp;Delegate&nbsp;method,&nbsp;Object&nbsp;args,&nbsp;Int32&nbsp;numArgs,&nbsp;Delegate&nbsp;catchHandler)&nbsp;\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*&nbsp;\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

&nbsp;

---

<div class="post-metadata">

**Author:** ![Edgar](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/e/b487fb/32.png) [@Edgar](https://community.thinkgeo.com/u/Edgar)\
**Post date:** [October 15, 2012, 9:11pm UTC](https://community.thinkgeo.com/t/featuresource-not-open-when-using-projections/3316/2 "2012-10-15T21:11:30Z")

</div>

Hi&nbsp;Thomas,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;the&nbsp;exception&nbsp;was&nbsp;caused&nbsp;by&nbsp;the&nbsp;multi-threading,&nbsp;when&nbsp;a&nbsp;featureSource&nbsp;just&nbsp;closed&nbsp;in&nbsp;a&nbsp;thread&nbsp;and&nbsp;it&nbsp;was&nbsp;querying&nbsp;in&nbsp;another&nbsp;thread,&nbsp;could&nbsp;you&nbsp;please&nbsp;provide&nbsp;the&nbsp;sample&nbsp;for&nbsp;us&nbsp;to&nbsp;see&nbsp;where&nbsp;the&nbsp;code&nbsp;is&nbsp;wrong?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Edgar
