We help IT Professionals succeed at work.

Visual Studio 2008 Error List showing spurious errors

NazoUK
NazoUK asked
on
Medium Priority
331 Views
Last Modified: 2013-12-17
My Visual Studio (developing asp.net applications) error list constantly shows hundreds of errors, even though there are actually none within the site. The errors are all of exactly the same type: 'The name xxx does not exist in the current context'. xxx refers to a server side control declaratively defined.  It seems like VS is checking the code behind files but isn't checking the declarative files when doing its checks.
The app builds without issue.

It's not killer, but it is annoying and makes it difficult to find genuine errors. I've applied all service packs and updates. Anyone encountered this and know how to fix it?
Comment
Watch Question

Dirk HaestProject manager
CERTIFIED EXPERT

Commented:
Found at another forum:  found out the that problem is cause by the back up copy from the same file (copy of default.aspx) that i forget to exclude from the project. The problem solved after i exclude the file from the project.

http://dotnetfish.blogspot.com/2007/08/name-xxx-does-not-exst-in-current.html
Dirk HaestProject manager
CERTIFIED EXPERT

Commented:
In your code behind you must create the member as well. When you drag/drop a control on you Layout View VS will generate this for you; otherwise you have to do it yourself. It isn't that hard:

 
public class MyWebPage : System.Web.UI.Page
{
     protected System.Web.UI.WebControls.Panel pnlDescription;
     // ...
 

Author

Commented:
Hi,

Thanks for the response but I've checked my project and there aren't any backup files in there.
Also, I've never heard of having to declare server controls in the code-behind as well and never seen it done in any of the books, blogs, articles etc I've read so I'm not convinced about that. Also I tested in VS layout view and it didn't automatically add anything.
Commented:
Turns out the problem is caused by a bug in Visual Studio SP 1.
Detailed information and a Hotfix can be found at

http://support.microsoft.com/kb/957259

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.