umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

Modelsbuilder failing to generate models due to SQL error #4731

Closed clausjensen closed 5 years ago

clausjensen commented 5 years ago

Note - this only happened one out of 4 times while testing installs from zip, with both sqlce and sqlserver. It happened on the sqlserver install:

When the site was installed - modelsbuilder was not able to generate models and generated this error:

Failed to build PureLive models.
There is already an open DataReader associated with this Command which must be closed first.

   at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
   at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteScalar()
   at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at NPoco.Database.ExecuteScalarHelper(DbCommand cmd)
   at NPoco.Database.ExecuteScalar[T](String sql, CommandType commandType, Object[] args)
   at Umbraco.Core.Scoping.Scope.ReadLock(Int32[] lockIds)
   at Umbraco.Core.Services.Implement.ContentTypeServiceBase`3.GetAll(Int32[] ids)
   at Umbraco.ModelsBuilder.Umbraco.UmbracoServices.GetAllTypes()
   at Umbraco.ModelsBuilder.Umbraco.PureLiveModelFactory.GetModelsAssembly(Boolean forceRebuild)
   at Umbraco.ModelsBuilder.Umbraco.PureLiveModelFactory.EnsureModels()

After triggering a generation of models (saving a document type) this error goes away but I then get a binding error trying to bind nucache content.

image

Republishing the content item will make this error go away as well and my content now renders.

zpqrtbnk commented 5 years ago

Fixed with https://github.com/umbraco/Umbraco-CMS/commit/aa86dfa9560fce3d77c73c78065beb114304d0c2

Which is not part of 8.0.0 but will be part of 8.0.1