Page error when viewstate of list controls enabled

Discussion in 'ASP .Net' started by nateastle, May 27, 2009.

  1. nateastle

    nateastle Guest

    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
     
    nateastle, May 27, 2009
    #1
    1. Advertising

  2. Hello nateastle,

    The problem seems to be in the serialization of the 'wsDevice.Device_List_WithUnusedLines_Output'
    type.

    Can you seriliaze these outside of the ASP.NEt context? You could try serializing
    it with the binary formatter and put it in a memorystream for testing purposes.

    Jesse

    > 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.InitNoM
    > embers () +97
    >
    > System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSer
    > ialize
    > (Object obj, ISurrogateSelector surrogateSelector, StreamingContext
    > context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
    > converter, ObjectWriter objectWriter) +7631358
    > System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Seriali
    > ze
    > (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.Seriali
    > ze (Stream serializationStream, Object graph, Header[] headers,
    > Boolean fCheck) +134
    >
    > System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Seriali
    > ze
    > (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.Seria
    > lize
    > (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
    >

    --
    Jesse Houwing
    jesse.houwing at sogeti.nl
     
    Jesse Houwing, May 28, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gabor
    Replies:
    3
    Views:
    645
    Jacob Yang [MSFT]
    Aug 26, 2003
  2. Cipher
    Replies:
    3
    Views:
    1,527
    coollzh
    Apr 30, 2004
  3. Leo J. Hart IV
    Replies:
    5
    Views:
    4,138
    Leo J. Hart IV
    Oct 10, 2004
  4. Adrian Parker

    viewstate on controls that are not enabled ?

    Adrian Parker, May 3, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    501
    Steven Cheng[MSFT]
    May 4, 2005
  5. JM_newsgroups
    Replies:
    2
    Views:
    642
    Rick Strahl
    Mar 12, 2008
Loading...

Share This Page