Orchard 1.6 - Orchard command line error

Topics: Customizing Orchard, Writing themes
Nov 16, 2012 at 5:18 PM

I added the CodeGen module to my Orchard 1.6 site in preparation for creating a new theme.

Any command (I tried several like "help commands", "codegen theme NewTheme") seems to generate the same error:

orchard> codegen theme NewTheme
Error executing command "codegen theme NewTheme"--------------------------------------------------------------------------------

Invalid object name 'Settings_ShellDescriptorRecord'.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'Settings_ShellDescriptorRecord'.
Stack Trace:
[SqlException: Invalid object name 'Settings_ShellDescriptorRecord'.]   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj, Boolean& dataReady)   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()   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, 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.System.Data.IDbCommand.ExecuteReader()   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)   at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
[GenericADOException: could not execute query[ select shelldescr0_.Id as Id459_, shelldescr0_.SerialNumber as SerialNu2_459_from Settings_ShellDescriptorRecord shelldescr0_ where shelldescr0_.Id is not null ][SQL: select shelldescr0_.Id as Id459_, shelldescr0_.SerialNumber as SerialNu2_459_ from Settings_ShellDescriptorRecord shelldescr0_ where shelldescr0_.Id is not null]]   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)   at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)   at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)   at NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)   at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)   at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)   at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression queryExpression, QueryParameters parameters)   at NHibernate.Impl.ExpressionQueryImpl.List()   at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)   at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)   at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression)   at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)   at Orchard.Data.Repository`1.Get(Expression`1 predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\Repository.cs:line 91   at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Get(Expression`1 predicate) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Data\Repository.cs:line 60   at Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetDescriptorRecord() in c:\Users\sebros\My Projects\Orchard\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:line 57   at Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetShellDescriptor() in c:\Users\sebros\My Projects\Orchard\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:line 30   at Orchard.Environment.ShellBuilders.ShellContextFactory.CreateShellContext(ShellSettings settings) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs:line 66   at Orchard.Environment.DefaultOrchardHost.CreateShellContext(ShellSettings settings) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:line 174   at Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.CreateStandaloneEnvironment(ShellSettings shellSettings) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Environment\DefaultOrchardHost.cs:line 91   at Orchard.Commands.CommandHostAgent.CreateStandaloneEnvironment(String tenant) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Commands\CommandHostAgent.cs:line 206   at Orchard.Commands.CommandHostAgent.RunCommand(TextReader input, TextWriteroutput, String tenant, String[] args, Dictionary`2 switches) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Commands\CommandHostAgent.cs:line 63
--------------------------------------------------------------------------------

I retrieved all rows from the table "Settings_ShellDescriptorRecord" and there was only one row with the following column data:

Id = 1, SerialNumber = 15

Windows 32, MS SQL Server 2012 Express SP1, OS is fully patched

Coordinator
Nov 16, 2012 at 5:45 PM

That's a known issue: http://orchard.codeplex.com/workitem/19228

Nov 16, 2012 at 6:35 PM

Bertrand,

I am new to this so forgive me if this is obvious. It seems in my case I have no commands available ("Help commands") being another example, and I get the long stack dump as opposed to the nice English message that lists available commands (as shown in the workitem). Are you certain that what I reported and the workitem are the same issue?

Coordinator
Nov 16, 2012 at 9:26 PM

I don't know. Other than that, does the site run at all?

Nov 16, 2012 at 9:50 PM

The site is running without any other problems observed. I am building up a replacement for a WordPress site so it is currently hosted on my Windows 7 development system in IIS. I had never had the need for command line processing until I decided to create a theme. I've worked around the issue by simply copying an existing them and cycling IIS.

Coordinator
Nov 16, 2012 at 9:52 PM

That works, yes.