# Exception Loading KML File

**URL:** <https://community.thinkgeo.com/t/exception-loading-kml-file/2575>\
**Category:** WinForms\
**Created:** [July 27, 2015, 3:52pm UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575 "2015-07-27T15:52:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![James6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@James6](https://community.thinkgeo.com/u/James6)\
**Post date:** [July 27, 2015, 3:52pm UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/1 "2015-07-27T15:52:20Z")

</div>

I&nbsp;was&nbsp;trying&nbsp;to&nbsp;load&nbsp;a&nbsp;KML&nbsp;file&nbsp;from&nbsp;the&nbsp;DesktopEditionSample&nbsp;KmlExtension&nbsp;example&nbsp;in&nbsp;my&nbsp;application,&nbsp;but&nbsp;I&nbsp;get&nbsp;the&nbsp;following&nbsp;exception&nbsp;on&nbsp;the&nbsp;map&nbsp;refresh.

The&nbsp;type&nbsp;initializer&nbsp;for&nbsp;'xRM=.OxY='&nbsp;threw&nbsp;an&nbsp;exception.

&nbsp;&nbsp;&nbsp;at&nbsp;xRM=.OxY=.PhY=(String&nbsp;nodeLocalName)  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.KmlFile.ReadStyles()  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.KmlFile.Open()  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.KmlFeatureSource.OpenCore()  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.FeatureSource.Open()  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.FeatureLayer.OpenCore()  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.Core.Layer.Open()  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas&nbsp;canvas)  
  
&nbsp;&nbsp;&nbsp;at&nbsp;ThinkGeo.MapSuite.DesktopEdition.Overlay.sRM=(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.dRQ=(IEnumerable`1&nbsp;drawingOverlays,&nbsp;RectangleShape&nbsp;extent)  
  
  
  
  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;void&nbsp;kMLToolStripMenuItem\_Click(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;winformsMap1.Overlays.Clear();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Set&nbsp;the&nbsp;geography&nbsp;unit&nbsp;to&nbsp;decimal&nbsp;degrees,&nbsp;to&nbsp;defines&nbsp;how&nbsp;your&nbsp;map&nbsp;data&nbsp;is&nbsp;stored  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;winformsMap1.MapUnit&nbsp;=&nbsp;GeographyUnit.DecimalDegree;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;winformsMap1.BackgroundOverlay.BackgroundBrush&nbsp;=&nbsp;new&nbsp;GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;winformsMap1.CurrentExtent&nbsp;=&nbsp;new&nbsp;RectangleShape(-122.0874,&nbsp;37.4245,&nbsp;-122.0804,&nbsp;37.4201);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WorldMapKitWmsDesktopOverlay&nbsp;worldMapKitDesktopOverlay&nbsp;=&nbsp;new&nbsp;WorldMapKitWmsDesktopOverlay();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;worldMapKitDesktopOverlay.Name&nbsp;=&nbsp;"worldMap";  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;worldMapKitDesktopOverlay.MapType&nbsp;=&nbsp;WorldMapKitMapType.Road;  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;winformsMap1.Overlays.Add("worldMap",&nbsp;worldMapKitDesktopOverlay);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KmlFeatureLayer&nbsp;layer&nbsp;=&nbsp;new&nbsp;KmlFeatureLayer("C:\\ThinkGEO\\KmlExtensionSample\\App\_Data\\KML\_Samples.kml");  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle&nbsp;=&nbsp;new&nbsp;AreaStyle(new&nbsp;GeoPen(GeoColor.SimpleColors.Black),&nbsp;new&nbsp;GeoSolidBrush(GeoColor.SimpleColors.Yellow));  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle&nbsp;=&nbsp;new&nbsp;LineStyle(new&nbsp;GeoPen(GeoColor.SimpleColors.Blue,&nbsp;5));  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle&nbsp;=&nbsp;new&nbsp;PointStyle(PointSymbolType.Circle,&nbsp;new&nbsp;GeoSolidBrush(GeoColor.SimpleColors.Green),&nbsp;10);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LayerOverlay&nbsp;stateOverlay&nbsp;=&nbsp;new&nbsp;LayerOverlay();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stateOverlay.Layers.Add("KmlLayer",&nbsp;layer);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;winformsMap1.Overlays.Add("StateOverlay",&nbsp;stateOverlay);  
  
&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;winformsMap1.Refresh();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
  
  
  
Thanks&nbsp;Jim

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [July 28, 2015, 12:34am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/2 "2015-07-28T00:34:27Z")

</div>

Hi&nbsp;Jim,&nbsp;  
&nbsp;&nbsp;  
&nbsp;From&nbsp;your&nbsp;exception&nbsp;information,&nbsp;it&nbsp;looks&nbsp;like&nbsp;that’s&nbsp;because&nbsp;your&nbsp;KML&nbsp;file&nbsp;contains&nbsp;invalid&nbsp;type&nbsp;for&nbsp;us.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Could&nbsp;you&nbsp;please&nbsp;upload&nbsp;a&nbsp;small&nbsp;test&nbsp;KML&nbsp;so&nbsp;we&nbsp;can&nbsp;use&nbsp;your&nbsp;code&nbsp;for&nbsp;reproduce&nbsp;it?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![James6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@James6](https://community.thinkgeo.com/u/James6)\
**Post date:** [July 28, 2015, 5:42am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/3 "2015-07-28T05:42:32Z")

</div>

I&nbsp;zip&nbsp;up&nbsp;the&nbsp;KML&nbsp;file,&nbsp;the&nbsp;file&nbsp;I&nbsp;am&nbsp;trying&nbsp;to&nbsp;load&nbsp;is&nbsp;the&nbsp;file&nbsp;from&nbsp;your&nbsp;sample&nbsp;program&nbsp;DesktopEditionSample&nbsp;KmlExtension.&nbsp;  
  
  
  
[wiki.thinkgeo.com/wiki/File:…100623.zip](http://wiki.thinkgeo.com/wiki/File:DesktopEditionSample_KmlExtension_CS_100623.zip)  
  
  
  
I&nbsp;am&nbsp;using&nbsp;Map&nbsp;Suite&nbsp;Desktop&nbsp;Edition&nbsp;9.0  
  
  
  
Thanks&nbsp;Jim  
  
  
[KML\_Samples.zip](https://community.thinkgeo.com/uploads/default/original/2X/a/af209ce5592308e3f872ce9648dcc462cbdecda2.zip) (7.84 KB)

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [July 29, 2015, 5:11am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/4 "2015-07-29T05:11:04Z")

</div>

Hi&nbsp;James,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;information,&nbsp;it&nbsp;looks&nbsp;we&nbsp;have&nbsp;put&nbsp;related&nbsp;code&nbsp;from&nbsp;KmlExtension&nbsp;into&nbsp;MapSuiteCore.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;tested&nbsp;that&nbsp;but&nbsp;found&nbsp;I&nbsp;cannot&nbsp;build&nbsp;index&nbsp;succeed.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;will&nbsp;look&nbsp;into&nbsp;it&nbsp;and&nbsp;any&nbsp;update&nbsp;will&nbsp;let&nbsp;you&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Troy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@Troy](https://community.thinkgeo.com/u/Troy)\
**Post date:** [August 11, 2015, 8:40pm UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/5 "2015-08-11T20:40:10Z")

</div>

Hi&nbsp;James,  
  
  
  
Sorry&nbsp;for&nbsp;the&nbsp;waiting.&nbsp;It’s&nbsp;proved&nbsp;a&nbsp;bug&nbsp;and&nbsp;we&nbsp;fixed&nbsp;in&nbsp;the&nbsp;latest&nbsp;daily&nbsp;build,&nbsp;would&nbsp;you&nbsp;please&nbsp;try&nbsp;it?&nbsp;The&nbsp;fixed&nbsp;version&nbsp;should&nbsp;be&nbsp;9.0.50.0&nbsp;and&nbsp;9.0.0.50.  
  
  
  
Thanks,  
  
  
  
Troy

---

<div class="post-metadata">

**Author:** ![Stephen3](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stephen3](https://community.thinkgeo.com/u/Stephen3)\
**Post date:** [October 8, 2015, 6:44am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/6 "2015-10-08T06:44:19Z")

</div>

Hi,&nbsp;&nbsp;  
&nbsp;Has&nbsp;this&nbsp;been&nbsp;resolved?&nbsp;I’m&nbsp;using&nbsp;MapSuiteCore.dll&nbsp;v9.0.0.77&nbsp;and&nbsp;am&nbsp;seeing&nbsp;the&nbsp;same&nbsp;issues&nbsp;as&nbsp;originally&nbsp;documented&nbsp;  
&nbsp;Thanks&nbsp;  
&nbsp;Steve

---

<div class="post-metadata">

**Author:** ![Troy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@Troy](https://community.thinkgeo.com/u/Troy)\
**Post date:** [October 9, 2015, 5:57am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/7 "2015-10-09T05:57:45Z")

</div>

Hi&nbsp;Steve,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;the&nbsp;mention,&nbsp;I&nbsp;checked&nbsp;it&nbsp;again&nbsp;and&nbsp;there&nbsp;is&nbsp;an&nbsp;issue&nbsp;when&nbsp;we&nbsp;secure&nbsp;the&nbsp;source&nbsp;code,&nbsp;we&nbsp;are&nbsp;working&nbsp;on&nbsp;it&nbsp;now&nbsp;and&nbsp;should&nbsp;fix&nbsp;it&nbsp;soon.&nbsp;  
&nbsp;I&nbsp;will&nbsp;update&nbsp;here&nbsp;once&nbsp;the&nbsp;new&nbsp;package&nbsp;is&nbsp;ready.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;Troy

---

<div class="post-metadata">

**Author:** ![Stephen3](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@Stephen3](https://community.thinkgeo.com/u/Stephen3)\
**Post date:** [December 11, 2015, 1:55am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/8 "2015-12-11T01:55:55Z")

</div>

Hi&nbsp;Troy,  
  
Has&nbsp;this&nbsp;been&nbsp;addressed&nbsp;yet?  
  
Thanks  
  
Steve

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [December 14, 2015, 2:28am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/9 "2015-12-14T02:28:34Z")

</div>

Hi&nbsp;Steven,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;it&nbsp;have&nbsp;been&nbsp;fixed,&nbsp;I&nbsp;tested&nbsp;the&nbsp;sample&nbsp;James&nbsp;mentioned,&nbsp;remove&nbsp;KmlExtension&nbsp;prject&nbsp;and&nbsp;it&nbsp;works&nbsp;well.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Does&nbsp;that&nbsp;still&nbsp;don’t&nbsp;works&nbsp;for&nbsp;you?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Saeer\_Butt](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@Saeer\_Butt](https://community.thinkgeo.com/u/Saeer_Butt)\
**Post date:** [May 6, 2016, 6:07pm UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/10 "2016-05-06T18:07:55Z")

</div>

How we can download this version to solve the problem ? I am having similar problem of loading a kml file using 9.0.0.0

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [May 9, 2016, 3:07am UTC](https://community.thinkgeo.com/t/exception-loading-kml-file/2575/11 "2016-05-09T03:07:37Z")

</div>

Hi Saeer,

Please download our product center, then get the latest development package like 9.0.x.0.

And if the issue still exist in the latest version please let us know. A simple sample which can reproduce that should be more helpful.

Regards,

Don
