6

Closed

EF.dll tries to load SQL Server provider even when not using SQL Server

description

EntityFramework.SqlServer is loaded when SaveChanges is called even when the SQL Server provider is not being used. Usually this is not noticed because the assembly is available and so the load succeeds. If the assembly is not available then the following exception is generated.

Unhandled Exception: System.TypeInitializationException: The type initializer for 'ExtentPlaceholderCreator' threw an ex
ception. ---> System.TypeLoadException: Method 'GetDbProviderManifestToken' in type 'System.Data.Entity.SqlServer.SqlPro
viderServices' from assembly 'EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e0
89' does not have an implementation.
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOn
ly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOn
ly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, Stac
kCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at System.Data.Entity.Config.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantNam
e)
at System.Data.Entity.Config.ProviderServicesFactory.GetInstanceByConvention(String providerInvariantName)
at System.Data.Entity.Config.DefaultProviderServicesResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple2 k)
at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory)
at System.Data.Entity.Config.CachingDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator
2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Config.RootDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
1 source, Func2 predicate)
at System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Config.CompositeResolver
2.GetService(Type type, Object key)
at System.Data.Entity.Config.IDbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key
)
at System.Data.Entity.Spatial.SpatialServicesLoader.LoadDefaultServices()
at System.Data.Entity.Spatial.DbSpatialServices.<.cctor>b__0()
at System.Lazy1.CreateValue()
at System.Lazy
1.LazyInitValue()
at System.Lazy1.get_Value()
at System.Data.Entity.Spatial.DbSpatialServices.get_Default()
at System.Data.Entity.Spatial.DbGeometry.FromText(String wellKnownText)
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.InitializeTypeDefaultMap()
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator..cctor()
--- End of inner exception stack trace ---
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.CreatePlaceholder(EntitySetBas
e extent)
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbScanExpression node)
at System.Data.Entity.Core.Common.CommandTrees.DbScanExpression.Accept[TResultType](DbExpressionVisitor
1 visitor)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateExpressionVisitor1.Visit(DbExpression expression)
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbProjectExpression node)
at System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType](DbExpressionVisitor
1 visitor)

at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Propagate(UpdateTranslator parent, EntitySet table, DbQ
ueryCommandTree umView)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<ProduceDynamicCommands>d__b.MoveNext()
at System.Linq.Enumerable.<ConcatIterator>d__711.MoveNext()
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable
1 commands, UpdateTranslato
r translator)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<Update>b__2(UpdateTranslator ut)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](IEntityStateManager entityCache, T noChanges
Result, Func`2 updateFunction, Boolean throwOnClosedConnection)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update(IEntityStateManager entityCache, Boolean throwO
nClosedConnection)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at System.Data.Entity.DbContext.SaveChanges()
at ConsoleApplication1.Program.Main(String[] args) in c:\Users\avickers\Documents\Visual Studio 2012\Projects\Console
Application1\ConsoleApplication1\Program.cs:line 49
Closed Jan 21 at 7:05 PM by BriceLambson

comments

BriceLambson wrote Jan 20 at 8:18 PM

Fixed in changeset 0a796b9b9b273c7f48854f0bd77f497f945cfbf7