Tuesday, 31 January 2017

Error Offline Database Retail 'SetClrFeatureSwitchMap' in DLL 'SqlServerSpatial110.dll'

I have Face issue after deploy patch KB3031055 and windows update, Offline database not working \syncing and giving error as below

The type initializer for 'ExtentPlaceholderCreator' threw an exception.: System.TypeInitializationException: The type initializer for 'ExtentPlaceholderCreator' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.EntryPointNotFoundException: Unable to find an entry point named 'SetClrFeatureSwitchMap' in DLL 'SqlServerSpatial110.dll'.
   at Microsoft.SqlServer.Types.GLNativeMethods.SetClrFeatureSwitchMap(Int32 clrFeatureSwitchMap)
   at Microsoft.SqlServer.Types.SqlGeometry.IsValidExpensive()
   at Microsoft.SqlServer.Types.SqlGeometry.Construct(GeoData g, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType type, SqlChars text, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeometry.STGeomFromText(SqlChars geometryTaggedText, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeometry.Parse(SqlString s)
   --- End of inner exception stack trace ---
   

Using Server 2012 R2 with SQLSERVER 2014.

Solution 

 adding the following lines to the pos.exe.config 
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" />
      <bindingRedirect oldVersion="1.0.0.0-11.0.0.0" newVersion="10.0.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>
This forces the EntityFramework to use the version 10 of the SqlServer.Types.dll, which doesn't have the Geometry type apparently.


And works fine.........................!!!