Home

ProviderIncompatibleException: The provider did not return a DbSpatialServices instance.

edited October 2012
I am using EF5 and sql express local db with spatial data.

I can run the unit tests in my project but not in LINQPad version 4.42.15
I have imported this to namespaces:
System.Data.Entity
System.Data.Spatial

Can anyone help?

Comments

  • did you ever get this figured out?
  • I'm experiencing the same problem. Everytime I try to materialize an entity that contains a DbGeography type, I'm getting the same error. Is there a solution?
  • For what's is worth, I also have the exact same problem.
    Anyone found a solution?
  • Try the latest beta build and let me know if there's any difference.

    Thanks!
    Joe
  • edited March 2013
    Unfortunately, I'm getting the same thing here, I get this error: ProviderIncompatibleException: The provider did not return a DbSpatialServices instance.

    Here is the stack trace:
     at System.Data.Common.DbProviderServices.GetSpatialDataReader(DbDataReader fromReader, String manifestToken)
       at System.Data.Spatial.SpatialHelpers.CreateSpatialDataReader(MetadataWorkspace workspace, DbDataReader reader)
       at System.Data.Common.Internal.Materialization.Shaper.CreateSpatialDataReader()
       at System.Data.Common.Utils.Singleton`1.get_Value()
       at System.Data.Common.Internal.Materialization.Shaper.<GetSpatialPropertyValueWithErrorHandling>b__d[TProperty](DbDataReader reader, Int32 column)
       at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
       at System.Data.Common.Internal.Materialization.Shaper.GetSpatialPropertyValueWithErrorHandling[TProperty](Int32 ordinal, String propertyName, String typeName, PrimitiveTypeKind spatialTypeKind)
       at lambda_method(Closure , Shaper )
       at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
       at lambda_method(Closure , Shaper )
       at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
       at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
       at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable`1 sequence)
       at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
       at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
       at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
  • edited March 2013
    I'm experiencing a different behavior now: When the query returns an object where the DbGeography properts is null or if I use a select statement to project to a viem model that doen't contain the gegraphy property, everything works well now - which is already an improvement.

    If the query returns a not null DbGrography property I'm now getting "InvalidProgramException: Common Language Runtime detected an invalid program"

    Stacktrace:
    at LINQPadSqlOrCEProviderServices45.GetDbSpatialDataReader(DbDataReader , String)
    at System.Data.Common.DbProviderServices.GetSpatialDataReader(DbDataReader fromReader, String manifestToken)

  • I've identified the InvalidProgramException bug and fixed it in the latest beta:
    http://www.linqpad.net/beta.aspx

    Let me know how you get on.
  • Hi Joe!

    The latest version is working fine now as far as I can see so far! Thank you very much! :)

    I have one more suggestion for an improvement: We store not only points but also polygons and multipolygons in our DbGeography colums. The polygons typically contain a lot of individual points (1,000 - 20,000) which makes the results hard to read. A setting that displays the contents of such a cell in the results truncated (to let's say 2000 characters) would help us significantly. This could also make sense for other cells.

    Thanks again! Max
  • I'll look into this. In the meantime, there are a couple of options:

    1. Edit | Preferences | Advanced - maximum column width in lists
    2. Click 'Results to Grids' before running the query - you'll then get resizable columns
  • Just a short update, v4.45.01 seems to work fine for me regarding the DbSpatialServices error.
  • After updating to beta 4.45.05, I am now able to query data that contains spatial values. But when I attempt to use the Distance() on a geography value, I am getting the following error (but the same query works in VS 2012).
    Specified type is not registered on the target server. System.Data.Spatial.DbGeography, System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
    Not sure if this is related, but looking at the SQL produced, the parameter looks funky:
    DECLARE @p__linq__0 Udt = SRID=4326;POINT (-95.25564 29.65735)
  • This is still an issue with LINQPad 4.47.01 Beta with .NET 4.5 / EF5
    Specified type is not registered on the target server.System.Data.Spatial.DbGeography, System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
    Stack:
       at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)
    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
    at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
    at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
    at LINQPad.Internal.LINQPadDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
    at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
    at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
  • The Glimpse team had a similar issue that they patched a few days ago. Could be related?

    https://github.com/Glimpse/Glimpse/issues/371
  • edited September 2013
    Yes, it could be related in that LINQPad also relies on a service provider hack with EF5. You could verify this by trying again with EF6, which has additional hooks that LINQPad uses instead of deploying the hack.
  • If there any further advice on this issue? I am not able to use EF6 so would prefer a work-around or fix for EF5
Sign In or Register to comment.