Home   |   Asp.Net 2.0   |   .Net Framework 2.0   |   IIS 6.0   |   Sql Server 2005   |   Visual Basic 2005   |   c# 2005   |   VS 2005   |   Visual Source Safe 2005

MS Dynamics CRM 3.0

SharePoint Portal Server 2003
SharePoint Server 2007
Dynamics NAV
Dynamics CRM
SharePoint Designer 2007
SharePoint Portal Server 2001
Windows SharePoint Services
Windows SharePoint Services 3.0
Project Server 2003
Project Server 2007
Dynamics – Point of Sale
Dynamics AX
Dynamics GP
Dynamics Retail Management System (RMS)
Dynamics SL
SQL Server 2000
Visual Basic .NET 2003
Visual C# .NET 2003
Visual C++ .NET 2003
Visual C++ 2005
Visual SourceSafe 6.0
Windows Server 2003
Windows Server 2003
Outlook 2003
ADO.NET 1.1
ASP.NET 1.0
Visual Studio Team Foundation Server
Visual Studio 2005 Team Edition
Windows Internet Explorer 7
BizTalk Server 2000
BizTalk Server 2002
BizTalk Server 2004
BizTalk Server 2006
Visual Studio 6.0
Access 2000
Access 2002
Access 2003
Access 2007
Access 97
Collaboration Data Objects 2.0
Commerce Server 2002
Content Management Server 2001
Commerce Server 2007
Content Management Server 2002
Data Access Components 2.7
Data Access Components 2.8
DirectX 9.0b
Office Small Business Accounting 2006
Accounting 2007
ActiveSync 4.1
Class Server 2.0
Groove 2007
Windows Vista
Outlook 2007
OneNote 2003
OneNote 2007
Office X for Mac
Zune software
Zune Live
Zoo Tycoon 2
Flight Simulator 2002
Dungeon Siege II

Cervo Technologies
The Right Source to Outsource

Oracle Database FAQS

Sharepoint Portal Server KB

Outlook 2007 Knowledge Base Articles

ASP.NET 2.0 Knowledge Base Articles

BUG: Error message in the Web server's event log when you try to deserialize data that is associated with a data type that is defined in the ASP.NET 2.0 code-behind file: A deserialization error occurred


Consider the following scenario:
You create a user control that uses the Microsoft .NET Framework 2.0.
The user control uses a Microsoft ASP.NET 2.0 code-behind file.
The ASP.NET 2.0 code-behind file defines a data type.
You try to deserialize data that is associated with the data type.
In this scenario, you may receive an error message in the Web server's event log that resembles the following:
Event code: 3011
Event message: A deserialization error occurred inside of ObjectStateFormatter. A property was typed as Type but the Type instance could not be created for 'YourCustomType, App_Web_6wc_5ues, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Event time: 15/05/2006 11:34:59 PM
Event time (UTC): 15/05/2006 3:34:59 AM
Event ID: 7878cf1cb270476f90c4d7f6191ed0ba
Event sequence: 3
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1/Root-1-12345678901234567
Trust level: Full
Application Virtual Path: /
Application Path: c:\inetpub\wwwroot\
Machine name: SERVER

Process information:
Process ID: 2596
Process name: aspnet_wp.exe
Account name: SERVER\ASPNET

Exception information:
Exception type: FileNotFoundException
Exception message: Could not load file or assembly 'App_Web_6wc_5ues, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Request information:
Request URL: http://localhost/default.aspx
Request path: /
User host address: 127.0.0.1
User:
Is authenticated: False
Authentication Type:
Thread account name: SERVER\ASPNET

Thread information:
Thread ID: 1
Thread account name: SERVER\ASPNET
Is impersonating: False
Stack trace:
at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError) at System.Web.UI.ObjectStateFormatter.DeserializeType(SerializerBinaryReader reader)
This problem occurs if the following conditions are true:
You marked public properties on the user control by using the [Personalizable] attribute. Alternatively, you implemented the IPersonalizable interface in the code-behind file to programmatically control which properties on the user control may be serialized and saved as personalization data.
The [Personalizable] attribute or the IPersonalizable interface references a data type that was defined in an ASP.NET 2.0 code-behind page or in a user control.
The deserialization process works as expected until the user control or the page that contains the data type definition is recompiled by ASP.NET 2.0.

CAUSE

This problem occurs when the user control or the page that contains the data type definition is recompiled by ASP.NET 2.0. Every time that ASP.NET 2.0 recompiles a user control or a page, ASP.NET 2.0 creates a new auto-generated assembly. The error message occurs when the type information that is stored in the personalization data tries to make a reference to the old auto-generated assembly.

WORKAROUND

To work around this problem, define the data types that are used for personalizable properties in one of the following locations:
In classes in the App_Code folder
In assemblies in the Bin folder
In GAC-deployed assemblies

MORE INFORMATION

The following code sample illustrates this problem.
public partial class TestUserControl : System.Web.UI.UserControl
{
    // Define a user data type.
    public enum userEnumDataType
    {
        Oranges = 1,
        Apples = 2,
        Bananas = 3
    };

    // Define a class member that uses the data type, and then assign a default value to it.
    private userEnumDataType myEnumDataType = userEnumDataType.Apples;

    // Define a property that uses the [Personalizable] attribute.
    [Personalizable]
    public userEnumDataType EnumDataType
    {
        get { return myEnumDataType; }
        set { myEnumDataType = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        refreshData(sender, e);
    }

    void refreshData(object sender, EventArgs e)
    {
        Label1.Text = myEnumDataType.ToString();
    }

}

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.


APPLIES TO
Microsoft .NET Framework 2.0
Microsoft ASP.NET 2.0

Keywords: 
kbnofix kbtshoot kbbug KB922621

Copyright © 2004 - 2007 Gridview.org, Inc. All rights reserved. Powered by Smart Web Content Management System