LinqDataSource, select new { ... } = "The state information is invalid for this page and might be corrupted."

6 posts, 0 answers
  1. Knud Nexø
    Knud Nexø avatar
    3 posts
    Member since:
    Oct 2009

    Posted 06 Oct 2009 Link to this post

    I'm using the RadGrid with a LinqDataSource and keep getting "The state information is invalid for this page and might be corrupted." error

    What am I doing wrong?

    The problem only occurs on the production server.
    Windows Server 2008 setup in a web farm of 3 computers.

    The following code generates an error. on the production server on postbacks (e.g. sorting, filtering or paging)... but not every single postback (about 1 in 3).
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="page2.aspx.cs" Inherits="site_admin_page2" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <div> 
            <asp:LinqDataSource ID="LinqDataSource1" runat="server"  
                onselecting="LinqDataSource1_Selecting"
            </asp:LinqDataSource> 
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
            </telerik:RadScriptManager> 
            <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"  
                AllowPaging="True" AllowSorting="True" DataSourceID="LinqDataSource1"  
                GridLines="None"
                <MasterTableView DataSourceID="LinqDataSource1"
                <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
     
                <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                </MasterTableView> 
            </telerik:RadGrid> 
        </div> 
        </form> 
    </body> 
    </html> 
     

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
     
    public partial class site_admin_page2 : System.Web.UI.Page 
        protected void Page_Load(object sender, EventArgs e) 
        { 
     
        } 
        protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) 
        { 
            DynamicData01DataContext dc = new DynamicData01DataContext(); 
     
            var products = from p in dc.tbl_Products 
                           select new 
                           { 
                               p.ProductID, 
                               p.ProductName, 
                               p.ProductPrice, 
                               p.ProductActive 
                           }; 
     
            e.Result = products; 
        } 
     

    here is the complete error
    Server Error in '/site' Application. 
    The state information is invalid for this page and might be corrupted. 
    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.Web.HttpException: The state information is invalid for this page and might be corrupted. 
     
    Source Error: 
     
    [No relevant source lines] 
     
     
    Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\f1255035\ee4d6829\App_Web_page2.aspx.c2099ada.oslnjh5d.0.cs    Line: 0 
     
    Assembly Load Trace: The following information can be helpful to determine why the assembly 'App_Web_page2.aspx.c2099ada.phfinkbb, Version=0.0.0.0, Culture=neutralPublicKeyToken=null' could not be loaded. 
     
    WRN: Assembly binding logging is turned OFF. 
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
    Note: There is some performance penalty associated with assembly bind failure logging. 
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 
     
     
    Stack Trace: 
     
    [FileNotFoundException: Could not load file or assembly 'App_Web_page2.aspx.c2099ada.phfinkbb, Version=0.0.0.0, Culture=neutralPublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.] 
       System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +0 
       System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +64 
       System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +58 
       System.Type.GetType(String typeName, Boolean throwOnError) +59 
       System.Web.UI.ObjectStateFormatter.DeserializeType(SerializerBinaryReader reader) +153 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +8625890 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +784 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +392 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +404 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +404 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +404 
       System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +392 
       System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +135 
     
    [ArgumentException: The serialized data is invalid.] 
       System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +199 
       System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +291 
       System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4 
       System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 
       System.Web.UI.HiddenFieldPageStatePersister.Load() +113 
     
    [ViewStateException: Invalid viewstate.  
        Client IP: 122.111.98.153 
        Port: 57393 
        User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729) 
        ViewState: /wEPDwUJMTU0NjY3OTgxD2QWAgIDD2QWBAIBDw9kPCsABgBkAgUPPCsADQIAFCsAAg8WCB4LXyFJdGVtQ291bnQCAR4LXyFEYXRhQm91bmRnHhdFbmFibGVBamF4U2tpblJlbmRlcmluZ2geC0VkaXRJbmRleGVzFgBkFwEFD1NlbGVjdGVkSW5kZXhlcxYAARYCFgpkFCsABBQrAAUWEB4KSGVhZGVyVGV4dAUJUHJvZHVjdElEHglEYXRhRmllbGQFCVByb2R1Y3RJRB4DX3NlBQlQcm9kdWN0SUQeCFJlYWRPbmx5Zx4IRGF0YVR5cGUZKwEeBG9pbmQCAh4EX2NmdmQeBF9jZmZkZGRkBQlQcm9kdWN0SUQUKwAFFhAfBAULUHJvZHVjdE5hbWUfBQULUHJvZHVjdE5hbWUfBgULUHJvZHVjdE5hbWUfB2cfCBkrAh8JAgMfCmQfC2RkZGQFC1Byb2R1Y3ROYW1lFCsABRYQHwtkHwpkHwYFDFByb2R1Y3RQcmljZR8EBQxQcm9kdWN0UHJpY2UfBQUMUHJvZHVjdFByaWNlHwgZKVtTeXN0ZW0uRGVjaW1hbCwgbXNjb3JsaWIsIFZlcnNpb249Mi4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5HwdnHwkCBGRkZAUMUHJvZHVjdFByaWNlFCsABRYQHwQFDVByb2R1Y3RBY3RpdmUeA19kZgUNUHJvZHVjdEFjdGl2ZR8GBQ1Qcm9kdWN0QWN0aXZlHwdnHwgZKwMfCQIFHwpkHwtkZGRkBQ1Qc...] 
     
    [HttpException (0x80004005): The state information is invalid for this page and might be corrupted.] 
       System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106 
       System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14 
       System.Web.UI.HiddenFieldPageStatePersister.Load() +217 
       System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105 
       System.Web.UI.Page.LoadAllState() +43 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 
       System.Web.UI.Page.ProcessRequest() +80 
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 
       System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
       ASP.site_admin_page2_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\f1255035\ee4d6829\App_Web_page2.aspx.c2099ada.oslnjh5d.0.cs:0 
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
     
     
    Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016  

    I've looked everywhere to see what the problem to this is... the following link is the closest to help identify the problem that I've come across even though it's an old post seems to be the same sort of problem
    http://www.telerik.com/community/forums/aspnet-ajax/grid/does-current-futures-build-support-linq-datasources.aspx

    To test I've created the same page but linked the LinqDataSource to a GridView and don't get the error paging and sorting work fine.
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <div> 
            <asp:LinqDataSource ID="LinqDataSource1" runat="server"  
                onselecting="LinqDataSource1_Selecting"
            </asp:LinqDataSource> 
             
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True"  
                AllowSorting="True" DataSourceID="LinqDataSource1"
            </asp:GridView> 
        </div> 
        </form> 
    </body> 
    </html> 
     

    also if I just change the LinqDataSource1_Selecting to not use "select new { ... } I also don't get the error... e.g.
        protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) 
        { 
            DynamicData01DataContext dc = new DynamicData01DataContext(); 
     
            var products = from p in dc.tbl_Products 
                           select p; 
     
            e.Result = products; 
        } 


    Please help... I really need to fix this problem.
    Have I missed something obvious?
    Could this have something to do with the Production server running as a webfarm?
    Has anyone else experienced this problem?



  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 09 Oct 2009 Link to this post

    Hello Knud,

    I am afraid that from information provided so far I am unable to determine the reason for this error.
    I could suggest you few things:
     - try setting EnableLinqExpressions to false
     - ensure that you are using latest version of Telerik.Web.UI assembly
     - ensure that you have your web farm properly configured

    Best wishes,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Knud Nexø
    Knud Nexø avatar
    3 posts
    Member since:
    Oct 2009

    Posted 05 Nov 2009 Link to this post

    Thanks the EnableLinqExpressions="false" option seemed to solve the problem...

    Just a couple of follow up questions.
    1. What changes does the "EnableLinqExpressions" option make?
    2. does it affect performance or anything?
    3. should I just set it to false for all my RadGrids?
    4. Where can I find more info on when and why I should set the "EnableLinqExpressions" option?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2009 Link to this post

    Hi,

    Here is a definition for the EnableLinqExpressions property :

    The EnableLinqExpressions property of RadGrid Prometheus 2008.1.325.35+ (i.e. only for the ASP.NET 3.5 build of the product) determines whether the control will use native linq expressions when performing sorting/filtering/etc. operations or the old logic inherited from the Classic grid control. The default value of this property is true.

    Thanks,
    Shinu

  6. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 12 Apr 2015 in reply to Shinu Link to this post

    I had to temporarily delete the RadAjaxManager that was hiding the underlying error:

     TypeLoadException: Could not load type 'System.Data.Entity.DynamicProxies.RepricingApproval_40D472CCAE59DB7A70B40FC6B029B430955A5ED87A7670652AA5B4D9D96A9A38' from assembly 'EntityFrameworkDynamicProxies.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.]

  7. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 12 Apr 2015 in reply to Peter Link to this post

    And just FYI, the fix for " TypeLoadException: Could not load type " was to set "EnableFlattening" to False for the EntityDataSource.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017