簡體   English   中英

Object 不能存儲在這種類型的數組中。 MVC c# 中的問題

[英]Object cannot be stored in an array of this type. issue in MVC c#

我在生產應用程序中面臨以下問題,並且無法找到任何特定位置或代碼作為錯誤的原因,任何人都可以有任何想法然后請提出解決方案。

message="Object cannot be stored in an array of this type."    
source="mscorlib"    
detail="System.InvalidCastException: Object cannot be stored in an array of this type.
   
at System.Array.InternalSetValue(Void* target, Object value)
   
at System.Array.SetValue(Object value, Int32[] indices)
   
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.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, 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 System.Web.Mvc.SessionStateTempDataProvider.LoadTempData(ControllerContext controllerContext)
   
at System.Web.Mvc.TempDataDictionary.Load(ControllerContext controllerContext, ITempDataProvider tempDataProvider)
   
at System.Web.Mvc.Controller.PossiblyLoadTempData()
   
at System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state)
   
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
   
at System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state)
   
at System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_0(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState)
   
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState)
   

at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
   
at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)"    user="extranet\0031O00003QP1nTQAT"    
time="2020-06-10T13:54:03.7681729Z">

我知道為時已晚,但我很好奇這方面是否有任何進展。

錯誤中的“System.Web.Mvc.TempDataDictionary.Load”肯定給出了線索,這與存儲在 TempData 中的數據有關。 我也遇到了這個問題,但我無法准確確定是什么數據造成了問題,因為代碼大量濫用臨時數據。 好消息是,我刪除了使用 TempData 存儲復雜類型的代碼。 已經 30 天了,異常不再發生。 瞧..!

https://github.com/dotnet/runtime/issues/28159

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM