views:

49

answers:

1

I recently added a new project to my Visual Studio 2008 solution. Now, as I make edits in the new project, I receive a ton (~50) of type checking errors - indicating that an assembly reference may be missing. However, when I actually build the solution, the errors go away. As best I can tell, my dependencies are set and the build order is correct. What could be wrong?

It doesn't prevent me from building and deploying, but it's a major nuisance. It makes it hard to tell when I actually have introduced new errors (until I do compile). Thus, it erodes the usefulness of having the error window do static analysis.

Example, one of the 50 errors is this: "The type of namespace name 'PersonManager' does not exist in the namespace 'Gideon' (are you missing an assembly reference?" In reference to this line of code: Gideon.PersonManager pm = new Gideon.PersonManager()

PersonManager is underlined in both places, and when I right click the type and selected 'find all references' I get an alert box that says "Cannot navigate to PersonManager"

However, the references are definitely there, because when I build, it works.

One other detail is that there is a mixture of C# and VB.net code, though I don't think that should make a difference.

+1  A: 

Well, yes, the IntelliSense parser is not an exact replica of the C# compiler. It has a very different job to do, it needs to do something meaningful while the code is utterly broken since you are editing it. Tough assignment, they did a tremendous job with it. But as a side-effect, it can fail to parse things that are actually legal. It's quite rare but not unheard of, seen it myself a few times.

This won't go anywhere concrete until you at least give us some idea of what kind of errors you are seeing, along with a snippet of the code that generates them. You didn't do so, I can only recommend that you select another window so you don't have to look at them.

Hans Passant
@Hans - this isn't just "while i'm typing" in the sense that it shows errors before i have completed a statement with valid syntax. I mean after I finish typing and I have something that *will* compile without errors -- it lists ~50 errors. I can show you a sample, I can edit it tomorrow, but there are so many errors from several different files. The vast majority of them are that it cannot find the type, suggesting an assembly may be missing (as I described).
pc1oad1etter
@Hans I have updated the question with an explicit example.
pc1oad1etter
IntelliSense is somehow using a different assembly than the compiler. Is it in the same solution? Chase down old copies of the DLL on your machine.
Hans Passant
I think that may have been it; after I did a Clean the errors went away. Weird!
pc1oad1etter