Problem after upgrading cache module to 0.9

Topics: Troubleshooting
Aug 12, 2011 at 3:41 PM

Yesterday I updated the cache module to 0.9 and then I got the following error:

String was not recognized as a valid Boolean.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid Boolean.

Source Error:

Line 9:          public int DefaultCacheDuration
Line 10:         {
Line 11:             get { return Record.DefaultCacheDuration; }
Line 12:             set { Record.DefaultCacheDuration = value; }
Line 13:         }


Source File: c:\WebRoot\localuser\bitsconnect_com\Modules\Contrib.Cache\Models\CacheSettingsPart.cs    Line: 11

Stack Trace:

[FormatException: String was not recognized as a valid Boolean.]
   System.Boolean.Parse(String value) +12634116
   NHibernate.Type.BooleanType.Get(IDataReader rs, Int32 index) +70
   NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name) +212
   NHibernate.Persister.Entity.AbstractEntityPersister.Hydrate(IDataReader rs, Object id, Object obj, ILoadable rootLoadable, String[][] suffixedPropertyColumns, Boolean allProperties, ISessionImplementor session) +1220
   NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32 i, Object obj, String instanceClass, EntityKey key, String rowIdAlias, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session) +715
   NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, EntityKey key, LockMode lockMode, String rowIdAlias, EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session) +423
   NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session) +768
   NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) +259
   NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +1383
   NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +114
   NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister) +557

[GenericADOException: could not load an entity: [Contrib.Cache.Models.CacheSettingsPartRecord#1][SQL: SELECT cachesetti0_.Id as Id1_0_, cachesetti0_.DefaultCacheDuration as DefaultC2_1_0_, cachesetti0_.DebugMode as DebugMode1_0_, cachesetti0_.IgnoredUrls as IgnoredU4_1_0_ FROM Contrib_Cache_CacheSettingsPartRecord cachesetti0_ WHERE cachesetti0_.Id=?]]
   NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister) +918
   NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId) +76
   NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object id, Object optionalObject, ISessionImplementor session) +32
   NHibernate.Event.Default.DefaultLoadEventListener.LoadFromDatasource(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) +185
   NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) +181
   NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) +1031
   NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) +403
   NHibernate.Impl.SessionImpl.Get(String entityName, Object id) +449
   NHibernate.Impl.SessionImpl.Get(Type entityClass, Object id) +374
   NHibernate.Impl.SessionImpl.Get(Object id) +391
   Orchard.Data.Repository`1.Get(Int32 id) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Data\Repository.cs:87
   Orchard.ContentManagement.Handlers.<>c__DisplayClass1.<Loading>b__0(TRecord prior) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\Handlers\StorageFilter.cs:54
   Orchard.ContentManagement.Utilities.LazyField`1.GetValue() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\Utilities\LazyField.cs:24
   Orchard.ContentManagement.ContentPart`1.get_Record() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\ContentPart.cs:73
   Contrib.Cache.Models.CacheSettingsPart.get_DefaultCacheDuration() in c:\WebRoot\localuser\bitsconnect_com\Modules\Contrib.Cache\Models\CacheSettingsPart.cs:11
   Contrib.Cache.Filters.OutputCacheFilter.<OnActionExecuting>b__2(AcquireContext`1 context) in c:\WebRoot\localuser\bitsconnect_com\Modules\Contrib.Cache\Filters\OutputCacheFilter.cs:87
   Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:57
   Orchard.Caching.Cache`2.AddEntry(TKey k, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:27
   System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory) +162
   Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:17
   Contrib.Cache.Filters.OutputCacheFilter.OnActionExecuting(ActionExecutingContext filterContext) in c:\WebRoot\localuser\bitsconnect_com\Modules\Contrib.Cache\Filters\OutputCacheFilter.cs:83
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +72
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +640
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +312
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +691
   System.Web.Mvc.Controller.ExecuteCore() +162
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +305
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Mvc\Routes\ShellRoute.cs:148
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

 

The way I resolved this was to use FTP to copy the "pre-upgrade" contents of the Contrib.Cache folder to the production server, effectively backing out the upgrade. Everything started working again.


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Aug 12, 2011 at 10:37 PM

This has now been fixed in the 0.9.1 release. See: http://orchardcache.codeplex.com/discussions/268853

Thank you Sebastien for a great module and ll your help.