Article ID: 825007 - View products that this article applies to.
You may experience problems when you try to add a user control to a Windows Form, or when you open a Windows Form that has a user control. This article describes the behavior that you may experience. It also describes the cause of this behavior and how you can work around it.
This article includes the steps to reproduce the behavior and links to references that contain more information about the SerializationException class, assemblies, how to configure Folder Redirection and roaming user profiles, and how to use the .NET Framework Configuration tool to configure code groups.
In Microsoft Visual Studio .NET 2003, you may be not be able to add a user control from the Toolbox to a Microsoft Windows Form. Additionally, when you open a Windows Form that contains a user control, or when you try to build a project that has a Windows Form that contains a user control, the user control may disappear. When this problem occurs, you may receive the following error messages in the Task List window:
A System.Runtime.Serialization.SerializationException exception error may also occur. The exception error message contains the following text:
The variable VariableName is either undeclared or never assigned.
Could not find Type Namespace.UserControlName. Please make sure the assembly that contains this type is referenced. If this is part of your development project make sure that it is properly built.
Note These error message examples use the following placeholders:
Insufficient state to deserialize the object. More information is needed.
Visual Studio .NET 2003 creates temporary files for project-level assemblies such as the assembly that contains the user control. These temporary files are located in the %APPDATA%\Microsoft\VisualStudio\7.1\ProjectAssemblies folder. Visual Studio .NET 2003 then loads the assemblies from the temporary files into memory. If you use folder redirection to redirect your Application Data folder to a folder that is not fully trusted, such as a network shared folder, Visual Studio .NET 2003 cannot load the assembly.
Typically, the problem that is mentioned in the "Symptoms" section occurs if you are using a roaming user profile.
Fully trust all files that are located in the ProjectAssemblies folder. To do this, follow these steps on your local computer:
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
Visual Studio .NET 2002 directly loads project-level assemblies into memory without using a temporary file. Therefore, the behavior that is mentioned in the "Symptoms" section does not occur in Visual Studio .NET 2002.
Steps to reproduce the problemNote Follow these steps after you redirect your Application Data folder to a folder that is not fully trusted.
For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
Configuring Folder Redirection
Roaming user profiles
Configuring code groups using the .NET Framework Configuration tool
Article ID: 825007 - Last Review: May 18, 2007 - Revision: 3.4
Contact us for more help
Connect with Answer Desk for expert help.