I have my .NET project target set to .NET 4 Full. It works well in Windows 7, 8 and 10.
When I try to use it in Windows XP while .NET 4 and SQL Express 2008 R2 is installed, a call to DbContext.SaveChanges()
throws an exception saying
This functionality requires .NET Framework 3.5 SP1. Please install .NET Framework 3.5 SP1 to use this functionality.
Once I install .NET 3.5 SP1 the error disappears. Considering the big size of .NET 3.5 SP1 installation pack (230 MB) what should I do now and why this even occurs? It's note worthy to say that I have also .NET 4.0 KB2468871 installed.
Full exception info:
An error occurred while updating the entries. See the inner exception for details.
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at System.Data.Entity.DbContext.SaveChanges()
at MyApp.Models.MyEntities.SaveChanges()
An error occurred while updating the entries. See the inner exception for details.
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](T noChangesResult, Func`2 updateFunction)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__d()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClassb.<SaveChangesInternal>b__8()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()****
This functionality requires .NET Framework 3.5 SP1. Please install .NET Framework 3.5 SP1 to use this functionality.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
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 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()****
EDIT
Just found this sadly posts:
Does you application need to use inside the database any of the following: Geography, Geometry or HierarchyId types, CLR-based User Defined Types, Functions, Aggregates, Triggers or Stored Procs?
If not, then there's nothing stopping you from using .NET Framework 4 to implement your application and using SQL Server 2008 R2 Express with it. It will work just fine with .NET Framework 4, for as long as you don't try to use CLR-based objects inside the database.
- Krzysztof Kozielczyk, Program Manager for SQL Server Express
And this
Does all SQL Server Express functionality work with .NET Framework 4 Beta 2?
No, there are few features that still require .NET Framework 2.0 SP2 or 3.5 SP1. These features will be disabled if .NET Framework 4 Beta 2 is the only .NET Framework on the machine, but will start working the moment .NET Framework 2.0 SP2 or 3.5 SP1 is installed.
The list of features that don’t work with .NET Framework 4 Beta 2:
The CLR data types geometry, geography, and hierarchyid. The dynamic management views for assemblies and spatial objects. The CLR user-defined types, functions, aggregates, procedures, and triggers.
Why some features don’t work with .NET Framework 4?
SQL Server Engine can only host one version of .NET Framework. In SQL Server 2008 it is .NET Framework 3.5 SP1. So hosting .NET Framework 4 Beta 2 in SP1 would mean that we no longer host .NET Framework 3.5 SP1. We simply don’t do this kind of breaking changes, since we try very hard to make sure that our Service Packs do not break any applications.
My app uses HierarchyId
in its procedures but it's hidden from EF as it doesn't support it currently.