N
nateastle
I have a set of controls on a page and if the viewstate of the
controls are enabled I get an error, if I disable the view state of
the controls, the page renders fine. The only way to get the viewstate
working on the controls again is by restarting IIS, or at least that
is what I have found. This only happens of list type controls ie
(dropdownlist, repeater, listbox, etc), I have a workaround, which is
rebinding everything on postback and have the viewstate disabled,
however, I would really like to know why this is happening.
I am unsure how to reproduce it, as this happens sporadically. My
local machine is IIS 7 but we get this error on IIS 6 as well. The
application is running as a website instead of a web application.
Any help would be appreciated.
The details of the error are:
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not
set to an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an
object.]
System.Type.GetRootElementType() +37
System.RuntimeType.get_ContainsGenericParameters() +16
System.RuntimeTypeCache.GetFullName() +31
System.RuntimeType.get_FullName() +16
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitNoMembers
() +97
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize
(Object obj, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter, ObjectWriter objectWriter) +7631358
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize
(Object obj, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter, ObjectWriter objectWriter) +51
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write
(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo
typeNameInfo) +7631620
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize
(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean
fCheck) +461
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize
(Stream serializationStream, Object graph, Header[] headers, Boolean
fCheck) +134
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize
(Stream serializationStream, Object graph) +13
System.Web.UI.ObjectStateFormatter.SerializeValue
(SerializerBinaryWriter writer, Object value) +845
[ArgumentException: Error serializing value
'wsDevice.Device_List_WithUnusedLines_Output' of type
'wsDevice.Device_List_WithUnusedLines_Output.']
System.Web.UI.ObjectStateFormatter.SerializeValue
(SerializerBinaryWriter writer, Object value) +3395
System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream,
Object stateGraph) +110
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +57
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize
(Object state) +4
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter,
Object stateGraph) +37
System.Web.UI.HiddenFieldPageStatePersister.Save() +79
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state)
+105
System.Web.UI.Page.SaveAllState() +236
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1099
Version Information: Microsoft .NET Framework Version:2.0.50727.3074;
ASP.NET Version:2.0.50727.3074
controls are enabled I get an error, if I disable the view state of
the controls, the page renders fine. The only way to get the viewstate
working on the controls again is by restarting IIS, or at least that
is what I have found. This only happens of list type controls ie
(dropdownlist, repeater, listbox, etc), I have a workaround, which is
rebinding everything on postback and have the viewstate disabled,
however, I would really like to know why this is happening.
I am unsure how to reproduce it, as this happens sporadically. My
local machine is IIS 7 but we get this error on IIS 6 as well. The
application is running as a website instead of a web application.
Any help would be appreciated.
The details of the error are:
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not
set to an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an
object.]
System.Type.GetRootElementType() +37
System.RuntimeType.get_ContainsGenericParameters() +16
System.RuntimeTypeCache.GetFullName() +31
System.RuntimeType.get_FullName() +16
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitNoMembers
() +97
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize
(Object obj, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter, ObjectWriter objectWriter) +7631358
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize
(Object obj, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter, ObjectWriter objectWriter) +51
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write
(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo
typeNameInfo) +7631620
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize
(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean
fCheck) +461
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize
(Stream serializationStream, Object graph, Header[] headers, Boolean
fCheck) +134
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize
(Stream serializationStream, Object graph) +13
System.Web.UI.ObjectStateFormatter.SerializeValue
(SerializerBinaryWriter writer, Object value) +845
[ArgumentException: Error serializing value
'wsDevice.Device_List_WithUnusedLines_Output' of type
'wsDevice.Device_List_WithUnusedLines_Output.']
System.Web.UI.ObjectStateFormatter.SerializeValue
(SerializerBinaryWriter writer, Object value) +3395
System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream,
Object stateGraph) +110
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +57
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize
(Object state) +4
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter,
Object stateGraph) +37
System.Web.UI.HiddenFieldPageStatePersister.Save() +79
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state)
+105
System.Web.UI.Page.SaveAllState() +236
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1099
Version Information: Microsoft .NET Framework Version:2.0.50727.3074;
ASP.NET Version:2.0.50727.3074