BUG: You cannot add a user control to a Windows Form in Visual Studio .NET 2003 (825007)
The information in this article applies to:
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
SUMMARYYou 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. SYMPTOMSIn 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:
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. A System.Runtime.Serialization.SerializationException exception
error may also occur. The exception error message contains the following text: Insufficient state to deserialize the object. More
information is needed. Note These error message examples use the following placeholders:
- VariableName is a placeholder
for the name of the user control variable.
- Namespace is a placeholder for
the name of the namespace that contains the user control class.
- UserControlName is a placeholder
for the name of the user control class.
Also, you may notice the error messages after you upgrade a
Microsoft Visual Basic 6.0 project to Microsoft Visual Basic .NET
2003. And, this problem does not occur in Microsoft Visual Studio
.NET 2002. CAUSEVisual 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.WORKAROUNDFully trust all files that are located in the ProjectAssemblies
folder. To do this, follow these steps on your local computer:
- Start the Microsoft .NET Framework 1.1 Configuration tool. The
.NET Configuration 1.1 window opens.
- In the left pane of the .NET Configuration
1.1 window, expand Runtime Security Policy, and then
expand Machine.
- Expand Code Groups, and then expand
All_Code.
- Right-click LocalIntranet_Zone, and then
click New. The Create Code Group dialog box
appears.
- Click to select the Create a new code
group option.
- In the Name box, type
MyCodeGroup, and then click
Next.
- In the Choose the condition type for this code
group box, click URL.
- To fully trust all files that are located in the ProjectAssemblies
folder, type the following text in the URL
box:
file:////FolderPath\Microsoft\VisualStudio\7.1\ProjectAssemblies\* Note FolderPath is a
placeholder for the path of the folder that you redirected the Application Data
folder to. - Click Next.
- In the Use existing permission set box,
click FullTrust, and then click
Next.
- Click Finish.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.REFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
Modification Type: | Major | Last Reviewed: | 6/19/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbDesigner kbpolicy kbMiscTools kbSysSettings kbTrusts kbProfiles kbSecurity kbUser kbUpgrade kberrmsg kbWindowsForms kbbug KB825007 kbAudDeveloper |
---|
|