简体   繁体   English

Object 不能存储在这种类型的数组中。 MVC c# 中的问题

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

I am facing below issue on production application and not able to found any specific location or code as a cause of the error can anyone having any idea then please suggest a solution.我在生产应用程序中面临以下问题,并且无法找到任何特定位置或代码作为错误的原因,任何人都可以有任何想法然后请提出解决方案。

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">

I know its late, but I am curious if there was any development on this.我知道为时已晚,但我很好奇这方面是否有任何进展。

The "System.Web.Mvc.TempDataDictionary.Load" in the error definitely gives the clue that, this is something do with data stored in TempData.错误中的“System.Web.Mvc.TempDataDictionary.Load”肯定给出了线索,这与存储在 TempData 中的数据有关。 I also experienced the problem, but I could not exactly identify what data created the problem, because the code was abusing temp data a lot.我也遇到了这个问题,但我无法准确确定是什么数据造成了问题,因为代码大量滥用临时数据。 Good news is that, I removed the code that uses TempData to store complex types.好消息是,我删除了使用 TempData 存储复杂类型的代码。 Its been 30 days and the exception is not happening again.已经 30 天了,异常不再发生。 Voila..!瞧..!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.InvalidCastException:Object 不能存储在这种类型的数组中。 在 C# - System.InvalidCastException: Object cannot be stored in an array of this type. in C# 创建未知类型的数组。 C# - Creating array of unknown type. C# InvalidCastException:无法从源类型转换为目标类型。 (Unity C#,foreach列表循环) - InvalidCastException: Cannot cast from source type to destination type. (Unity c# ,foreach list loop) DbArithmeticExpression参数必须具有数字公用类型。 在C#MVC中 - DbArithmeticExpression arguments must have a numeric common type. in c# MVC c# '' 是一个变量,但用作类型。 我该如何解决这个问题? - c# '' is a variable but is used as a type. How can i solve this issue? 发生“ PatientInformation”对象的吸气剂的异常与目标类型不匹配。 C#.NET - Exception occurred getter of 'PatientInformation' Object does not match target type. C# .NET c# object型阵列 - c# object type array Asp.Net MVC C#不能隐式转换类型问题 - Asp.Net MVC C# Cannot Implicitly Convert Type Issue C#在使用AutocompleteStringCollection时无法将对象类型数组转换为字符串类型数组 - C# cannot convert object type array to string type array while using AutocompleteStringCollection 接口无法声明类型问题C# - Interfaces Cannot Declare Type Issue C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM