title: Why do I get TypeLoadExceptionHolder errors after recycling my IIS app pool?
body: <p>I have an ASP.NET web application that uses StateServer for the session.  The app stores several bits of information in the session; one in particular being an object graph where all of the objects involved have the Serializable attribute.  This all works fine until I recycle the app pool that hosts the web app.</p>
  
  <p>If I'm logged in and my session has an object graph stored in it and I recycle the app pool then reload the page, I get the following exception:</p>
  
  <pre><code>Error in: MyUrl Source: mscorlib Error Message: Object of type 'System.Runtime.Serialization.TypeLoadExceptionHolder' cannot be converted to type 'MyObject'. 
  Stack Trace:    
  
  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.FormatterServices.PopulateObjectMembers(Object obj, MemberInfo[] members, Object[] data)
  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 System.Web.HttpSessionStateWrapper.get_Item(String name)
  at MyCode
  </code></pre>
  
  <p>I was under the impression that because the session state is stored out of proc that it would be unaffected by recycling the app pool.  Is this not the case?</p>