Microsoft Knowledge Base Email Alertz

KBAlertz.com: (894438) - Describes a problem that occurs in Microsoft Visual Studio .NET 2003. When you try to open a project that contains an inherited user control, you receive an error message.

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 2.0 Web Hosting with SQL 2005: Click Here!
Discount ASP.NET Hosting


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




You receive an "Object reference not set to an instance of an object" error message when you try to open a project that contains an inherited user control in Visual Studio .NET or Visual Studio 2005

Article ID:894438
Last Review:December 11, 2006
Revision:3.8
On This Page

SYMPTOMS

When you try to open a project that contains an inherited user control, you receive an error message that is similar to the following:
Object reference not set to an instance of an object.
This problem occurs in Microsoft Visual Studio .NET or in Microsoft Visual Studio 2005.

Note This problem occurs when your project contains Web references.

Back to the top

CAUSE

This problem occurs when you save your project with XML attribute characters that are not valid in the project path. Examples of XML attribute characters that are not valid follow:
•#
•&
When you try to open the project that contains the inherited user control, Visual Studio .NET 2003 or Visual Studio 2005 scans through the references to find the base type of the control. All references are stored in an XML fragment. The "#" character and the "&" character are valid Windows directory characters. However, they are not valid characters XML attribute characters. This causes Visual Studio .NET 2003 or Visual Studio 2005 to stop scanning through the references when these characters are encountered. Therefore, the base type of the control is not found.

Back to the top

WORKAROUND

To work around this problem, you must avoid using XML attribute characters that are not valid. Do not use the "#" character and the "&" character in the project path.

Back to the top

MORE INFORMATION

Steps to reproduce the problem

1.Start Visual Studio .NET 2003 or Visual Studio 2005.
2.On the File menu, click New, click Project, click Visual Basic Projects, and then click Windows Application.

Note In Visual Studio 2005, click Visual Basic.
3.Type the following in the Location box, and then click OK.

Drive_Letter:\My&Directory
4.In Solution Explorer, right-click Windows Application1, click Add, click Add User Control, click User Control under Templates, and then click Open.
5.On the View menu, click ToolBox.
6.Add the TextBox control to the user control in the Designer.
7.On the Build menu, click Build Solution.
8.In Solution Explorer, right-click Windows Application1, click Add, click Add Inherited Control, click Inherited User Control under Templates, and then click Open.
9.In the Inheritance Picker window, click UserControl1 that you created in step 4, and then click OK.
10.In Solution Explorer, right-click Windows Application1, and then click Add Web Reference.
11.In the Add Web Reference dialog box, type your WebService in the URL box, and then click Add Reference.
12.On the File menu, click Close to close all documents.
13.Try to open UserControl2.vb in the Designer.

You receive the error message that is mentioned in the "Symptoms" section.

Back to the top


APPLIES TO
•Microsoft Visual Studio 2005 Professional Edition
•Microsoft Visual Studio 2005 Standard Edition
•Microsoft Visual Studio .NET 2003 Professional Edition
•Microsoft Visual Studio .NET 2002 Professional Edition
•Microsoft Visual C# .NET 2003 Standard Edition
•Microsoft Visual C# .NET 2002 Standard Edition
•Microsoft Visual C# 2005 Express Edition
•Microsoft Visual C++ .NET 2003 Standard Edition
•Microsoft Visual C++ .NET 2002 Standard Edition
•Microsoft Visual C++ 2005 Express Edition
•Microsoft Visual Basic .NET 2003 Standard Edition
•Microsoft Visual Basic .NET 2002 Standard Edition
•Microsoft Visual Basic 2005

Back to the top

Keywords: 
kbvs2005swept kbvs2005applies kbvs2002sp1sweep kbtshoot kbbug KB894438

Back to the top

       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please