Version manager 0.93 does not work

Topics: Core, Troubleshooting
Sep 27, 2012 at 9:48 AM

I have added version manager 0.93. I can see the versions of a page. But when I preview a version different than version=1 I get an exception.

Has somebody a solution?

The exception is created in the following code in the DefaultContentManager.cs.

VersionNumber=1 works, but VersionNumber=2 and more fails.

 

if
(options.VersionNumber != 0) {
versionRecord = contentItemVersionRecords.FirstOrDefault(
x => x.Number == options.VersionNumber) ??
_contentItemVersionRepository.Get(
x => x.ContentItemRecord == contentItem.Record && x.Number == options.VersionNumber);
}

Exception in log file

2012-09-27 10:44:48,197 [5] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at lambda_method(Closure )
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Evaluate(Expression e)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Visit(Expression exp)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitBinary(BinaryExpression b)
   at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Visit(Expression exp)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitBinary(BinaryExpression b)
   at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Visit(Expression exp)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitLambda(LambdaExpression lambda)
   at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Visit(Expression exp)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitUnary(UnaryExpression u)
   at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Visit(Expression exp)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitList(ReadOnlyCollection`1 original)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitMethodCall(MethodCallExpression m)
   at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Visit(Expression exp)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitList(ReadOnlyCollection`1 original)
   at NHibernate.Linq.Visitors.ExpressionVisitor.VisitMethodCall(MethodCallExpression m)
   at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Visit(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator.Eval(Expression exp)
   at NHibernate.Linq.Visitors.Evaluator.PartialEval(Expression expression, Func`2 fnCanBeEvaluated)
   at NHibernate.Linq.Visitors.Evaluator.PartialEval(Expression expression)
   at NHibernate.Linq.NHibernateQueryProvider.TranslateExpression(Expression expression)
   at NHibernate.Linq.NHibernateQueryProvider.Execute(Expression expression)
   at NHibernate.Linq.QueryProvider.System.Linq.IQueryProvider.Execute[T](Expression expression)
   at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
   at Orchard.Data.Repository`1.Get(Expression`1 predicate) in c:\Users\Administrator\Dropbox\Orchard\Orchard.Source.1.5.1\src\Orchard\Data\Repository.cs:line 91
   at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Get(Expression`1 predicate) in c:\Users\Administrator\Dropbox\Orchard\Orchard.Source.1.5.1\src\Orchard\Data\Repository.cs:line 60
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in c:\Users\Administrator\Dropbox\Orchard\Orchard.Source.1.5.1\src\Orchard\ContentManagement\DefaultContentManager.cs:line 165
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in c:\Users\Administrator\Dropbox\Orchard\Orchard.Source.1.5.1\src\Orchard\ContentManagement\DefaultContentManager.cs:line 111
   at Orchard.Core.Contents.Controllers.ItemController.Preview(Int32 id, Nullable`1 version) in c:\Users\Administrator\Dropbox\Orchard\Orchard.Source.1.5.1\src\Orchard.Web\Core\Contents\Controllers\ItemController.cs:line 47
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

Coordinator
Sep 30, 2012 at 10:30 PM

It's a pretty old module, maybe there are compatibility issues with the current Orchard. Fix it and take ownership. I can get you in contact with the author.

Oct 1, 2012 at 9:01 AM

I think the problem is within the core of Orchard. If you preview a content item and adds the '?version=1' in the url you get the first version. If you ask another version you get an exception. The version manager is calling the correct url, but the exception is from the defaultcontentmanager of Orchard. I hope someone of the Orchard team can fix this. Versionmanagement in Orchard would be a great feature to me. If the module must call another url to get a previous version, please let me know and I will try to find the change for the version manager module.

Coordinator
Oct 2, 2012 at 2:44 AM

Please file a bug then.

Oct 2, 2012 at 6:11 AM

You'r right! I created the issue 'Can not preview all versions of content' for this.