# System.ArgumentException: The format of the well known binary is incorrect in 6.0.345.0 dlls

**URL:** <https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406>\
**Category:** WPF\
**Created:** [April 26, 2013, 10:32am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406 "2013-04-26T10:32:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlos1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/6a8cbe/32.png) [@Carlos1](https://community.thinkgeo.com/u/Carlos1)\
**Post date:** [April 26, 2013, 10:32am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/1 "2013-04-26T10:32:01Z")

</div>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hi&nbsp;Guys,

&nbsp;My&nbsp;TilePreCacher&nbsp;was&nbsp;working&nbsp;fine&nbsp;with&nbsp;dlls&nbsp;version&nbsp;6.0.260.0&nbsp;and&nbsp;now&nbsp;throws&nbsp;the&nbsp;following&nbsp;exception:

System.ArgumentException:&nbsp;The&nbsp;format&nbsp;of&nbsp;the&nbsp;well&nbsp;known&nbsp;binary&nbsp;is&nbsp;incorrect.  
  
Nombre&nbsp;del&nbsp;parámetro:&nbsp;wellKnownBinary&nbsp;---\>&nbsp;System.ArgumentException:&nbsp;24413:&nbsp;Not&nbsp;valid&nbsp;because&nbsp;of&nbsp;two&nbsp;overlapping&nbsp;edges&nbsp;in&nbsp;curve&nbsp;(1).  
  
en&nbsp;ThinkGeo.MapSuite.Core.BaseShape.CreateShapeFromWellKnownData(Byte[]&nbsp;wellKnownBinary)  
  
---&nbsp;Fin&nbsp;del&nbsp;seguimiento&nbsp;de&nbsp;la&nbsp;pila&nbsp;de&nbsp;la&nbsp;excepción&nbsp;interna&nbsp;---  
  
en&nbsp;ThinkGeo.MapSuite.Core.BaseShape.CreateShapeFromWellKnownData(Byte[]&nbsp;wellKnownBinary)  
  
en&nbsp;ThinkGeo.MapSuite.Core.Feature.GetShape()  
  
en&nbsp;ThinkGeo.MapSuite.Core.LineStyle.SiE=(RectangleShape&nbsp;fmM=,&nbsp;IEnumerable`1&nbsp;f2M=)  
  
en&nbsp;ThinkGeo.MapSuite.Core.LineStyle.DrawCore(IEnumerable`1&nbsp;features,&nbsp;GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInThisLayer,&nbsp;Collection`1&nbsp;labelsInAllLayers)  
  
en&nbsp;ThinkGeo.MapSuite.Core.Style.Draw(IEnumerable`1&nbsp;features,&nbsp;GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInThisLayer,&nbsp;Collection`1&nbsp;labelsInAllLayers)  
  
en&nbsp;ThinkGeo.MapSuite.Core.ZoomLevel.DrawCore(GeoCanvas&nbsp;canvas,&nbsp;IEnumerable`1&nbsp;features,&nbsp;Collection`1&nbsp;currentLayerLabels,&nbsp;Collection`1&nbsp;allLayerLabels)  
  
en&nbsp;ThinkGeo.MapSuite.Core.ZoomLevel.Draw(GeoCanvas&nbsp;canvas,&nbsp;IEnumerable`1&nbsp;features,&nbsp;Collection`1&nbsp;currentLayerLabels,&nbsp;Collection`1&nbsp;allLayerLabels)  
  
en&nbsp;ThinkGeo.MapSuite.Core.ShapeFileFeatureLayer.ZlU=(GeoCanvas&nbsp;Z1U=,&nbsp;RectangleShape&nbsp;aFU=,&nbsp;Collection`1&nbsp;aVU=,&nbsp;ZoomLevel&nbsp;alU=,&nbsp;Collection`1&nbsp;a1U=,&nbsp;Collection`1&nbsp;bFU=,&nbsp;ShapeFileFeatureSource&nbsp;bVU=,&nbsp;Collection`1&nbsp;blU=,&nbsp;Collection`1&nbsp;b1U=)  
  
en&nbsp;ThinkGeo.MapSuite.Core.ShapeFileFeatureLayer.WVU=(GeoCanvas&nbsp;WlU=,&nbsp;RectangleShape&nbsp;W1U=,&nbsp;Collection`1&nbsp;XFU=,&nbsp;ZoomLevel&nbsp;XVU=,&nbsp;Collection`1&nbsp;XlU=,&nbsp;ShapeFileFeatureSource&nbsp;X1U=,&nbsp;Collection`1&nbsp;YFU=,&nbsp;Collection`1&nbsp;YVU=)  
  
en&nbsp;ThinkGeo.MapSuite.Core.ShapeFileFeatureLayer.DrawCore(GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInAllLayers)  
  
en&nbsp;ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInAllLayers)  
  
en&nbsp;TilePreCacherIssueDemo.Module1.Main()&nbsp;en&nbsp;Z:\Documents\Mis&nbsp;Documentos\Visual&nbsp;Studio&nbsp;Projects\TilePreCacherIssueDemo\TilePreCacherIssueDemo\Module1.vb:línea&nbsp;39

&nbsp;You&nbsp;can&nbsp;download&nbsp;the&nbsp;refered&nbsp;shape&nbsp;file&nbsp;from&nbsp;here:&nbsp;dl.dropboxusercontent.com/u/6792052/GebcoOneBathyA4.rar

&nbsp;And&nbsp;this&nbsp;is&nbsp;the&nbsp;source&nbsp;I&nbsp;used:

&nbsp;Imports&nbsp;System.Collections.ObjectModel

Imports&nbsp;ThinkGeo.MapSuite.Core

Imports&nbsp;ThinkGeo.MapSuite.WpfDesktopEdition

&nbsp;

Module&nbsp;Module1

&nbsp;

&nbsp;&nbsp;Sub&nbsp;Main()

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;ZoomLevelIdx&nbsp;As&nbsp;Integer&nbsp;=&nbsp;13

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;cacheDirectory&nbsp;As&nbsp;String&nbsp;=&nbsp;".\TileCache"

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;cacheId&nbsp;As&nbsp;String&nbsp;=&nbsp;"WorldMapOverlay"

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;ZoomLevelSet&nbsp;As&nbsp;New&nbsp;ZoomLevelSet

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;mapUnit&nbsp;As&nbsp;GeographyUnit&nbsp;=&nbsp;GeographyUnit.DecimalDegree

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;GebcoOneBathymetricLayer&nbsp;As&nbsp;ShapeFileFeatureLayer&nbsp;=&nbsp;New&nbsp;ShapeFileFeatureLayer(".\GebcoOneBathyA4.shp",&nbsp;ShapeFileReadWriteMode.ReadOnly)

&nbsp;&nbsp;&nbsp;&nbsp;GebcoOneBathymetricLayer.ZoomLevelSet.ZoomLevel08.DefaultLineStyle&nbsp;=&nbsp;New&nbsp;LineStyle(New&nbsp;GeoPen(GeoColor.SimpleColors.Silver,&nbsp;1))

&nbsp;&nbsp;&nbsp;&nbsp;GebcoOneBathymetricLayer.ZoomLevelSet.ZoomLevel08.ApplyUntilZoomLevel&nbsp;=&nbsp;ApplyUntilZoomLevel.Level15

&nbsp;&nbsp;&nbsp;&nbsp;GebcoOneBathymetricLayer.WrappingExtent&nbsp;=&nbsp;New&nbsp;RectangleShape(-180,&nbsp;90,&nbsp;180,&nbsp;-90)

&nbsp;&nbsp;&nbsp;&nbsp;GebcoOneBathymetricLayer.WrappingMode&nbsp;=&nbsp;WrappingMode.WrapDateline

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;'Create&nbsp;a&nbsp;tile&nbsp;cache&nbsp;object&nbsp;with&nbsp;the&nbsp;cache&nbsp;directory&nbsp;and&nbsp;cache&nbsp;id.

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;tileCache&nbsp;As&nbsp;New&nbsp;FileBitmapTileCache(cacheDirectory,&nbsp;cacheId)

&nbsp;&nbsp;&nbsp;&nbsp;tileCache.ImageFormat&nbsp;=&nbsp;TileImageFormat.Png

&nbsp;&nbsp;&nbsp;&nbsp;tileCache.TileMatrix.Scale&nbsp;=&nbsp;ZoomLevelSet.GetZoomLevels(ZoomLevelIdx).Scale

&nbsp;&nbsp;&nbsp;&nbsp;tileCache.TileMatrix.BoundingBox&nbsp;=&nbsp;New&nbsp;RectangleShape(-100000000,&nbsp;100000000,&nbsp;100000000,&nbsp;-100000000)

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;cell&nbsp;As&nbsp;New&nbsp;TileMatrixCell(694,&nbsp;4330,&nbsp;New&nbsp;RectangleShape(10.283203125,&nbsp;59.501953125,&nbsp;10.3271484375,&nbsp;59.4580078125))

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;create&nbsp;a&nbsp;bitmap&nbsp;whoes&nbsp;size&nbsp;equals&nbsp;to&nbsp;the&nbsp;tile&nbsp;size.

&nbsp;&nbsp;&nbsp;&nbsp;Using&nbsp;bitmap&nbsp;As&nbsp;New&nbsp;System.Drawing.Bitmap(256,&nbsp;256)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;create&nbsp;a&nbsp;GeoCanvas&nbsp;which&nbsp;for&nbsp;drawing&nbsp;the&nbsp;passed&nbsp;layers.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;geoCanvas&nbsp;As&nbsp;New&nbsp;GdiPlusGeoCanvas()

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geoCanvas.BeginDrawing(bitmap,&nbsp;cell.BoundingBox,&nbsp;mapUnit)

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SyncLock&nbsp;GebcoOneBathymetricLayer

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;Not&nbsp;GebcoOneBathymetricLayer.IsOpen&nbsp;Then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GebcoOneBathymetricLayer.Open()

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Try

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GebcoOneBathymetricLayer.Draw(geoCanvas,&nbsp;New&nbsp;Collection(Of&nbsp;SimpleCandidate)())&nbsp;&nbsp;'\<\<\<---&nbsp;Exception&nbsp;ocurs&nbsp;here

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine("OK")

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Catch&nbsp;ex&nbsp;As&nbsp;Exception

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine("Cell&nbsp;Col:&nbsp;"&nbsp;&&nbsp;cell.Column&nbsp;&&nbsp;"&nbsp;Row:&nbsp;"&nbsp;&&nbsp;cell.Row&nbsp;&&nbsp;"&nbsp;BB:&nbsp;"&nbsp;&&nbsp;cell.BoundingBox.ToString&nbsp;&&nbsp;vbCrLf&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;"Exception:&nbsp;"&nbsp;&&nbsp;ex.ToString())

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Try

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;SyncLock

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geoCanvas.EndDrawing()

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;create&nbsp;tile&nbsp;object&nbsp;to&nbsp;maintain&nbsp;current&nbsp;tile&nbsp;information.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;tile&nbsp;As&nbsp;New&nbsp;BitmapTile(bitmap,&nbsp;cell.BoundingBox,&nbsp;ZoomLevelSet.GetZoomLevels(ZoomLevelIdx).Scale)

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;save&nbsp;tile.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tileCache.SaveTile(tile)

&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Using

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;Console.ReadKey()

&nbsp;&nbsp;End&nbsp;Sub

&nbsp;

End&nbsp;Module

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [April 29, 2013, 5:00am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/2 "2013-04-29T05:00:42Z")

</div>

Hi&nbsp;Carlos,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;post,&nbsp;this&nbsp;is&nbsp;because&nbsp;we&nbsp;set&nbsp;BaseShape.GeometryLibrary&nbsp;as&nbsp;GeometryLibrary.Unmanaged&nbsp;by&nbsp;default,&nbsp;&nbsp;would&nbsp;you&nbsp;please&nbsp;add:&nbsp;  
&nbsp;&nbsp;  
&nbsp;BaseShape.GeometryLibrary&nbsp;=&nbsp;GeometryLibrary.Managed;&nbsp;  
&nbsp;&nbsp;  
&nbsp;This&nbsp;should&nbsp;solve&nbsp;the&nbsp;problem,&nbsp;because:&nbsp;  
&nbsp;&nbsp;  
&nbsp;When&nbsp;using&nbsp;BaseShape.GeometryLibrary&nbsp;=&nbsp;GeometryLibrary.Managed,&nbsp;we&nbsp;use&nbsp;the&nbsp;NTS&nbsp;to&nbsp;check&nbsp;the&nbsp;data&nbsp;validation&nbsp;  
&nbsp;When&nbsp;using&nbsp;BaseShape.GeometryLibrary&nbsp;=&nbsp;GeometryLibrary.Unmanaged&nbsp;or&nbsp;BaseShape.GeometryLibrary&nbsp;=&nbsp;GeometryLibrary.Defualt,&nbsp;we&nbsp;use&nbsp;the&nbsp;Sqltype&nbsp;&nbsp;to&nbsp;check&nbsp;the&nbsp;data&nbsp;validation&nbsp;  
&nbsp;As&nbsp;Sqltype&nbsp;have&nbsp;a&nbsp;stricker&nbsp;validation-checking,&nbsp;some&nbsp;data&nbsp;will&nbsp;not&nbsp;pass&nbsp;SqlType&nbsp;validation&nbsp;check&nbsp;and&nbsp;the&nbsp;exception&nbsp;will&nbsp;be&nbsp;thrown.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Hope&nbsp;it&nbsp;helps,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Johnny&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![Carlos1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/6a8cbe/32.png) [@Carlos1](https://community.thinkgeo.com/u/Carlos1)\
**Post date:** [April 29, 2013, 6:46am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/3 "2013-04-29T06:46:30Z")

</div>

Hi&nbsp;Johnny,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;I&nbsp;guessed&nbsp;it&nbsp;so,&nbsp;but&nbsp;in&nbsp;6.0.260.0&nbsp;it&nbsp;already&nbsp;was&nbsp;already&nbsp;unmanaged&nbsp;as&nbsp;default.&nbsp;In&nbsp;fact&nbsp;I&nbsp;have&nbsp;been&nbsp;using&nbsp;unmanaged&nbsp;since&nbsp;you&nbsp;introduced&nbsp;the&nbsp;sqltypes&nbsp;library&nbsp;long&nbsp;time&nbsp;ago&nbsp;(back&nbsp;in&nbsp;5.5?).&nbsp;&nbsp;So&nbsp;It&nbsp;should&nbsp;be&nbsp;other&nbsp;the&nbsp;reason…

---

<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:** [April 30, 2013, 1:25am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/4 "2013-04-30T01:25:50Z")

</div>

Hi&nbsp;Carlos,  
&nbsp;  
In&nbsp;this&nbsp;case,&nbsp;you&nbsp;should&nbsp;set&nbsp;it&nbsp;to&nbsp;Managed&nbsp;to&nbsp;pass&nbsp;the&nbsp;validation,&nbsp;the&nbsp;wkb&nbsp;is&nbsp;not&nbsp;recongnized&nbsp;as&nbsp;valid&nbsp;by&nbsp;Sql&nbsp;types&nbsp;but&nbsp;it’s&nbsp;valid&nbsp;by&nbsp;NTS.&nbsp;Here&nbsp;are&nbsp;the&nbsp;screencasts&nbsp;to&nbsp;show&nbsp;the&nbsp;differences.  
&nbsp;  
Not&nbsp;Using&nbsp;it:  
&nbsp;  
[screencast.com/t/w5ZS95F1PozE](http://screencast.com/t/w5ZS95F1PozE)  
&nbsp;  
Using&nbsp;it  
&nbsp;  
[screencast.com/t/KlxXZYjPahFP](http://screencast.com/t/KlxXZYjPahFP)  
&nbsp;  
&nbsp;  
Regards,  
Edgar

---

<div class="post-metadata">

**Author:** ![Carlos1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/6a8cbe/32.png) [@Carlos1](https://community.thinkgeo.com/u/Carlos1)\
**Post date:** [April 30, 2013, 2:05am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/5 "2013-04-30T02:05:32Z")

</div>

Hi&nbsp;Edgar,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;I&nbsp;fully&nbsp;understand&nbsp;the&nbsp;difference&nbsp;between&nbsp;SQL&nbsp;Types&nbsp;and&nbsp;NTS,&nbsp;but&nbsp;the&nbsp;point&nbsp;here&nbsp;is&nbsp;that&nbsp;the&nbsp;same&nbsp;code&nbsp;specifying&nbsp;unmanaged&nbsp;(SQL&nbsp;Types)&nbsp;with&nbsp;6.0.260.0&nbsp;DLLs&nbsp;was&nbsp;working&nbsp;fine.&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;Do&nbsp;you&nbsp;attempt&nbsp;to&nbsp;MakeValid&nbsp;the&nbsp;invalid&nbsp;features&nbsp;internally&nbsp;or&nbsp;is&nbsp;there&nbsp;any&nbsp;other&nbsp;way&nbsp;to&nbsp;overcome&nbsp;this&nbsp;without&nbsp;give&nbsp;up&nbsp;the&nbsp;use&nbsp;of&nbsp;SQL&nbsp;types&nbsp;and&nbsp;return&nbsp;permanently&nbsp;to&nbsp;NTS&nbsp;library?

---

<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:** [April 30, 2013, 3:13am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/6 "2013-04-30T03:13:33Z")

</div>

Carlos,&nbsp;  
&nbsp;&nbsp;  
&nbsp;In&nbsp;version&nbsp;6.0.260.0,&nbsp;we&nbsp;haven’t&nbsp;apply&nbsp;the&nbsp;Sql&nbsp;types&nbsp;validation&nbsp;to&nbsp;the&nbsp;BaseShape.CreateShapeFromWellKnownData,&nbsp;so&nbsp;there&nbsp;was&nbsp;no&nbsp;exception&nbsp;that&nbsp;time.&nbsp;We&nbsp;just&nbsp;added&nbsp;this&nbsp;validation&nbsp;recently&nbsp;so&nbsp;you&nbsp;got&nbsp;this&nbsp;exception.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;Edgar

---

<div class="post-metadata">

**Author:** ![Carlos1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/6a8cbe/32.png) [@Carlos1](https://community.thinkgeo.com/u/Carlos1)\
**Post date:** [April 30, 2013, 3:57am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/7 "2013-04-30T03:57:34Z")

</div>

Ok,&nbsp;that&nbsp;makes&nbsp;sense.&nbsp;Then,&nbsp;is&nbsp;there&nbsp;any&nbsp;way&nbsp;so&nbsp;BaseShape.CreateShapeFromWellKnownData&nbsp;tries&nbsp;call&nbsp;MakeValid&nbsp;before&nbsp;throwing&nbsp;the&nbsp;exception?&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;I&nbsp;guess&nbsp;you&nbsp;will&nbsp;discontinue&nbsp;NTS&nbsp;library&nbsp;at&nbsp;some&nbsp;point,&nbsp;so&nbsp;using&nbsp;it&nbsp;permanently&nbsp;doesn’t&nbsp;seem&nbsp;to&nbsp;be&nbsp;a&nbsp;good&nbsp;idea,&nbsp;or&nbsp;it&nbsp;is?

---

<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:** [April 30, 2013, 5:04am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/8 "2013-04-30T05:04:22Z")

</div>

I&nbsp;think&nbsp;you&nbsp;can&nbsp;use&nbsp;the&nbsp;valid&nbsp;shape&nbsp;files&nbsp;or&nbsp;override&nbsp;the&nbsp;LineStyle.DrawCore&nbsp;method&nbsp;in&nbsp;this&nbsp;case,&nbsp;and&nbsp;implement&nbsp;like&nbsp;below,

`Public Class MyLineStyle : Inherits LineStyle    Sub New(geoPen As GeoPen)        MyBase.New(geoPen)    End Sub    Protected Overrides Sub DrawCore(features As IEnumerable(Of Feature), canvas As GeoCanvas, labelsInThisLayer As Collection(Of SimpleCandidate), labelsInAllLayers As Collection(Of SimpleCandidate))        Dim validFeature As New Collection(Of Feature)        For Each feature As Feature In features            validFeature.Add(feature.MakeValid())        Next        MyBase.DrawCore(validFeature, canvas, labelsInThisLayer, labelsInAllLayers)    End SubEnd Class`

and&nbsp;I'm&nbsp;not&nbsp;sure&nbsp;when&nbsp;will&nbsp;we&nbsp;give&nbsp;up&nbsp;the&nbsp;NTS,&nbsp;but&nbsp;I&nbsp;think&nbsp;providing&nbsp;the&nbsp;valid&nbsp;data&nbsp;is&nbsp;necessary&nbsp;is&nbsp;the&nbsp;main&nbsp;part.

Regards,

Edgar

---

<div class="post-metadata">

**Author:** ![Carlos1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/6a8cbe/32.png) [@Carlos1](https://community.thinkgeo.com/u/Carlos1)\
**Post date:** [April 30, 2013, 5:22am UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/9 "2013-04-30T05:22:22Z")

</div>

Hi&nbsp;Edgar,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;Providing&nbsp;valid&nbsp;data&nbsp;is&nbsp;fine&nbsp;when&nbsp;you&nbsp;own/control&nbsp;all&nbsp;the&nbsp;source&nbsp;shape&nbsp;files,&nbsp;this&nbsp;would&nbsp;be&nbsp;in&nbsp;a&nbsp;ideal&nbsp;world,&nbsp;unfortunately&nbsp;our&nbsp;is&nbsp;not,&nbsp;so&nbsp;the&nbsp;code&nbsp;should&nbsp;be&nbsp;protective&nbsp;instead&nbsp;of&nbsp;preventive.&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;Thanks&nbsp;for&nbsp;the&nbsp;LineStyle&nbsp;code&nbsp;sample,&nbsp;but&nbsp;how&nbsp;can&nbsp;I&nbsp;use&nbsp;it&nbsp;within&nbsp;your&nbsp;BaseShape.CreateShapeFromWellKnownData&nbsp;used&nbsp;in&nbsp;ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInAllLayers)?&nbsp;I&nbsp;mean,&nbsp;I&nbsp;wish&nbsp;to&nbsp;continue&nbsp;using&nbsp;sql&nbsp;types&nbsp;library,&nbsp;to&nbsp;use&nbsp;the&nbsp;new&nbsp;dlls&nbsp;6.0.345.0&nbsp;or&nbsp;newer&nbsp;plus&nbsp;and&nbsp;use&nbsp;the&nbsp;not-under-my-control-shapefiles&nbsp;I&nbsp;have&nbsp;been&nbsp;using&nbsp;for&nbsp;a&nbsp;while&nbsp;now.&nbsp;Is&nbsp;it&nbsp;possible&nbsp;anyhow?

---

<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:** [April 30, 2013, 8:25pm UTC](https://community.thinkgeo.com/t/system-argumentexception-the-format-of-the-well-known-binary-is-incorrect-in-6-0-345-0-dlls/3406/10 "2013-04-30T20:25:22Z")

</div>

Carlos,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;in&nbsp;this&nbsp;way&nbsp;you&nbsp;should&nbsp;inherit&nbsp;the&nbsp;ShapeFileFeatureLayer&nbsp;and&nbsp;override&nbsp;the&nbsp;methods&nbsp;which&nbsp;return&nbsp;features&nbsp;such&nbsp;as&nbsp;GetAllFeatures,&nbsp;GetFeaturesByIds,&nbsp;make&nbsp;them&nbsp;valid&nbsp;before&nbsp;returning.&nbsp;In&nbsp;this&nbsp;way&nbsp;the&nbsp;features&nbsp;are&nbsp;valid&nbsp;and&nbsp;they&nbsp;can&nbsp;pass&nbsp;the&nbsp;BaseShape.CreateShapeFromWellKnownData()&nbsp;internall&nbsp;and&nbsp;you&nbsp;will&nbsp;not&nbsp;worry&nbsp;about&nbsp;this&nbsp;method.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;Edgar
