6

So, I refactored some code related to my custom facets.

I pushed it to the stage and it doesn't throw any errors (of course).

I push it to production and it starts throwing this error over and over -- to the point that the Fail protection of IIS kicks in and restarts the app pool.

> 4876 10:35:40 WARN  Overriding expired contact session lock for
> contact id: a13624a7-bcd0-41ca-93c2-9ba815419464 4876 10:35:40 ERROR
> Cannot create tracker. Exception: System.ArgumentException Message:
> Object of type 'System.Runtime.Serialization.TypeLoadExceptionHolder'
> cannot be converted to type
> 'Sitecore.Analytics.Model.Framework.IFacet'. Source: mscorlib    at
> System.RuntimeType.TryChangeType(Object value, Binder binder,
> CultureInfo culture, Boolean needsSpecialCast)    at
> System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo
> culture, BindingFlags invokeAttr)    at
> System.Reflection.RtFieldInfo.UnsafeSetValue(Object obj, Object value,
> BindingFlags invokeAttr, Binder binder, CultureInfo culture)    at
> System.Runtime.Serialization.FormatterServices.SerializationSetValue(MemberInfo
> fi, Object target, Object value)    at
> System.Runtime.Serialization.ObjectManager.DoValueTypeFixup(FieldInfo
> memberToFix, ObjectHolder holder, Object value)    at
> System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder
> holder, Boolean bObjectFullyComplete)    at
> System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder
> holder)    at
> System.Runtime.Serialization.ObjectManager.RegisterObject(Object obj,
> Int64 objectID, SerializationInfo info, Int64 idOfContainingObj,
> MemberInfo member, Int32[] arrayIndex)    at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object
> obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString)    at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord
> pr)    at
> System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()   
> at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
> handler, __BinaryParser serParser, Boolean fCheck, Boolean
> isCrossAppDomain, IMethodCallMessage methodCallMessage)    at
> System.Web.Util.AltSerialization.ReadValueFromStream(BinaryReader
> reader)    at
> System.Web.SessionState.SessionStateItemCollection.ReadValueFromStreamWithAssert()
> at
> System.Web.SessionState.SessionStateItemCollection.DeserializeItem(String
> name, Boolean check)    at
> System.Web.SessionState.SessionStateItemCollection.get_Item(String
> name)    at
> Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateManager.LockAndLoadContact(Guid
> contactId)    at
> Sitecore.Analytics.Tracking.ContactManager.TryLoadContact(Guid
> contactId, Int32 lockDurationMinutes)    at
> Sitecore.Analytics.Pipelines.EnsureSessionContext.LoadContact.Process(InitializeTrackerArgs
> args)    at (Object , Object[] )    at
> Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)    at
> Sitecore.Analytics.Pipelines.EnsureSessionContext.EnsureSessionContextPipeline.Run(InitializeTrackerArgs
> args)    at Sitecore.Analytics.DefaultTracker.EnsureSessionContext()  
> at
> Sitecore.Analytics.Pipelines.CreateTracker.GetTracker.Process(CreateTrackerArgs
> args)    at (Object , Object[] )    at
> Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)    at
> Sitecore.Analytics.Tracker.Initialize()
> 
> 4876 10:35:40 ERROR Application error. Exception:
> System.InvalidOperationException Message: Tracker.Current is not
> initialized Source: Sitecore.Analytics    at
> Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs
> args)    at (Object , Object[] )    at
> Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)    at
> Sitecore.Analytics.Pipelines.StartAnalytics.StartAnalyticsPipeline.Run()
> at
> Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking.Process(RequestBeginArgs
> args)    at (Object , Object[] )    at
> Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)    at
> Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String
> pipelineName, TArgs args)    at
> Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext
> context, AsyncCallback cb, Object extraData)    at
> System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
> at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
> Boolean& completedSynchronously)

Any ideas?

I am running Sitecore 8.1 Update 2.

6

Remove all data from your shared session database and the errors will go away.

Your custom types have changed, but at the same time, old facet objects remain binary-serialized in your shared session database (as a part of Contact objects). And so your session store provider cannot deserialize them anymore.

.NET binary serialization doesn't throw exceptions when an object cannot be deserialized. Instead, it replaces the object with a TypeLoadExceptionHolder instance.

  • 2
    I can't tell you how much time I wasted trying to figure out TypeLoadExceptionHandler back in the day (2010 to be precise: productiveonceaday.blogspot.com/2010/02/…, one of the few times I can link to my blog and have it be a relevant link). – Ed Schwehm Oct 13 '16 at 18:37
0

In my case (i am running Sitecore 9) the facet types also changed and some of the old facet objects remained serialized on disk in ~\Website\App_Data\Submit Queue folder. After deleting the file in that folder the problem is fixed. The reason why Sitecore stores facet objects there is that if the xConnect is not available for whatever reason the current session gets serialized (including contacts info and facets) and is written into ~\Website\App_Data\Submit Queue folder. Sitecore then retries sending this session data to xConnect at certain intervals.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.