FIX: Too many delegate types in a managed type definition causes a C1001 compiler error in Visual Studio .NET 2002 (315544)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition

This article was previously published under Q315544

SYMPTOMS

When you define more than 18 delegate types in a managed type (class or struct), and then you try to compile the code, you receive the following error message:
"Q315544.cpp(181) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2844) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information"

RESOLUTION

Move the delegate definitions outside of the managed type definition. For example, if you have a class such as the following:
__gc class CApp {
    __delegate int MyFunc1(int);
    ////Place the other 18 delegate definitions here.
}
				
you can work around the problem by placing the delegate definitions as in the following sample code:
__delegate int MyFunc1(int);
__gc class CApp {
     MyFunc1* one;
}
				

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in all versions of Visual Studio .NET (2003).

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a Managed Extensions for C++ class, such as that shown in the following sample code:
    __gc class CApp {
           //// 
    }
    					
  2. Add 19 delegate definitions to the class by using the __delegate keyword, for example:
    __gc class CApp {
        __delegate int MyFunc1(int);
        ////Place the other 18 delegate definitions here.
    }
    					
  3. Compile the code.

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

305980 PRB: C1001 Compiler Error Message - Suggestions for Troubleshooting

For additional resources, see the following Microsoft Developer Network (MSDN) articles:

Modification Type:MinorLast Reviewed:8/25/2005
Keywords:kbvs2002sp1sweep kbfix kbbug kbpending KB315544