• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

Handling an InvalidCastException using SQL CLR Data Types on Cloud Sites


Our clusters now have the MSSQL 2012 data types installed (assembly version 11.0) in addition to the MSSQL 2008 data types (assembly version 10.0). This may introduce errors for some custom applications.

In particular you may see this error when referencing SQLTypes from assembly version 11.0:

System.InvalidCastException: Unable to cast object of type 'Microsoft.SqlServer.Types.SqlGeometry' to type 'Microsoft.SqlServer.Types.SqlGeometry'.

This issue can be worked around in code or by specifying a value of "SQL Server 2012" for the "Type System Version" attribute in your connection string.

For code examples and more details, please see the "SQL CLR Data Types" section of this Microsoft document on changes in the SQL Server 2012 database engine:

Breaking Changes to Database Engine Features in SQL Server 2012







© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER