Re: Intermittent compiler error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Charles Law (blank_at_nowhere.com)
Date: 04/30/04


Date: Fri, 30 Apr 2004 16:34:41 +0100

Hi Chris

This is one of those niggly things that is oft' reported but for which no
one seems to have a hard and fast resolution. I get exactly the same thing,
but hopefully the following will help:

I have found that the more tightly coupled a solution, the more likely the
problem is to occur. Also, check the references section of each project
properties in your solution, and make sure that there are no erroneous
entries. The order of the directories listed also seems to make a
difference. Try to be consistent in the order, i.e. order the references the
same way for each project.

The problem seems more prevalent when there are multiple classes with the
same name, or where a property has the same name as a class.

Organise classes to maintain the minimum scope across the solution, i.e.
make things private wherever possible, and refactor in order to decrease the
scope as far as possible.

HTH

Charles

"Chris Peacock" <chrisp.takethisout@videss.co.uk> wrote in message
news:12EB6804-F34D-4FF9-9DAC-A2B9D69FEF45@microsoft.com...
> Using Visual Studio .NET 2003, I'm intermittently getting the VB.NET error
BC30002 ("Type ... is not defined.") when I build a particular assembly that
I have written. This error does not occur every time the assembly is built,
and seems more likely to occur when a change has been made in the assembly
and it is another dependent assembly that is being built.
>
> The type that it claims is not defined is a nested class which is derived
from another nested class within the parent class' base class. I.e.,
DerivedClass.DerivedNestedClass, defined as (in pseudo code):-
>
> public class DerivedClass
> inherits BaseClass
>
> protected class DerivedNestedClass
> inherits BaseClass.NestedClass
> .
> .
> .
> end class
> .
> .
> .
> end class
>
> public mustinherit class BaseClass
> implements AnInterface
>
> public mustinherit class NestedClass
> .
> .
> .
> end class
> .
> .
> .
> end class
>
> AnInterface is used to expose a COM IDispatch interface to BaseClass (in
case that's relevant).
>
> When the compiler does not complain, all of the code seems to work fine.
Almost always, changing something unrelated in the contents of the classes
involved makes the error go away - it will then appear again later, for no
apparent reason!
>
> There is obviously a lot more to the class structure than I have shown
here such as virtual (mustinherit) functions and properties. I've spent a
lot of time trying to tweak things to fix the problem, and so don't really
have time to pinpoint the exact cause of it - I was hoping someone else may
have experienced the same thing and be able to point me in the right
direction. I would happy to include more about the class structure on
request, however, if anyone has any ideas about this.
>
> Thanks for any help.
>



Relevant Pages

  • Intermittent compiler error
    ... The type that it claims is not defined is a nested class which is derived from another nested class within the parent class' base class. ... public class DerivedClass ... public mustinherit class BaseClass ... AnInterface is used to expose a COM IDispatch interface to BaseClass. ...
    (microsoft.public.dotnet.general)
  • Is vs IsAssignableFrom to detect and interface
    ... I have an interface IMyInterface that is implemented by BaseClass. ... also have a class DerivedClass that is inherited from BaseClass. ... TypetPossibleTypes; ... the is keyword does not detect the interface IMyInterface. ...
    (microsoft.public.dotnet.framework)
  • Re: cool thing with memberfunction pointers as parameters
    ... > void CallVirtual(BaseClassFunc pF, void* ... > class DerivedClass: public BaseClass ...
    (comp.lang.cpp)
  • Simulatneous declare/initialize member variable
    ... allow simultaneous declaration and initilization of member data? ... class DerivedClass: BaseClass { ...
    (comp.lang.cpp)