We sometimes - very infrequently, but sometimes - get an error about the DynamicProxies assembly generated by Entity Framework when using the RedisSessionStateProvider.
Server Error in '/' Application.
Unable to find assembly 'EntityFrameworkDynamicProxies-MyDataDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
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.Runtime.Serialization.SerializationException: Unable to find assembly 'EntityFrameworkDynamicProxies-MyDataDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SerializationException: Unable to find assembly 'EntityFrameworkDynamicProxies-MyDataDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.]
System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly() +3444057
System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name) +11601726
System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable) +122
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record) +286
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum) +57
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() +461
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +120
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +186
Microsoft.Web.Redis.RedisUtility.GetObjectFromBytes(Byte[] dataAsBytes) +121
Microsoft.Web.Redis.StackExchangeClientConnection.GetSessionDataStatic(Object rowDataFromRedis) +219
Microsoft.Web.Redis.StackExchangeClientConnection.GetSessionData(Object rowDataFromRedis) +7
Microsoft.Web.Redis.RedisConnectionWrapper.TryTakeWriteLockAndGetData(DateTime lockTime, Int32 lockTimeout, Object& lockId, ISessionStateItemCollection& data, Int32& sessionTimeout) +310
Microsoft.Web.Redis.RedisSessionStateProvider.GetItemFromSessionStore(Boolean isWriteLockRequired, HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +804
Microsoft.Web.Redis.RedisSessionStateProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +127
System.Web.SessionState.SessionStateModule.GetSessionStateItem() +111
System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state) +233
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.HttpAsyncResult.End() +9643911
System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar) +39
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9670421
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0
I'm 95% certain that none of the Entity Framework-generated objects I am storing in session are Dynamic Proxies. I've got that turned off for all the places where the objects end up in session. So I'm not sure why this error would be happening. I'm trying to do more testing to be 100% certain.
Have you seen this before? Any ideas? Any idea how to debug the problem to isolate it to certain objects?