Lines of code may be missing if you compile a solution that has a complex project structure in Visual Studio 2008
Lines of code may be missing if you compile a solution that has a complex project structure in Microsoft Visual Studio 2008. The solution may incorrectly compile to Microsoft intermediate language (MSIL) code that omits certain method calls in the compiled .dll file. This problem occurs when there are method calls to classes, and these classes participate in an inheritance hierarchy that uses generic constraints.
- When this problem occurs, you do not receive an error message.
- You may experience this problem intermittently. For example, you may be able to temporarily resolve this problem by cleaning the solution. However, cleaning the solution is not a permanent resolution. The problem may reoccur if the file reference pattern that is mentioned in the "Cause" section is not modified.
- Because the method call is missing from the MSIL code, breakpoints that you set on this line in the source code may move to the next line during debugging.
This problem occurs when the Visual Studio 2008 solution has the following structure:
- The solution contains five or more projects, arranged in a specific configuration. For example, the solution contains five projects that are named Project 1, Project 2, Project A, Project B, and Project C.
- Project 1 has project references to Project A and to Project B. Additionally, Project 1 has a file reference to Project C.
- For more information about project references, visit the following Microsoft Web site:
- A file reference is a direct reference to the compiled assembly.
- Project C has references to Project A and to Project B. These references can be either file references or project references.
- Project 2 has a file reference to Project A.
Note To view a diagram of this structure, see the "More Information" section.Additionally, the Visual Studio 2008 solution must use generic constraints as follows:
- You have a class or an interface that is named AA and that is defined in Project A.
- You have a generic class that is named ClassB that is in Project B and that has an interface constraint on a type parameter T for AA.
- You have a class that is named ClassC in Project C and that inherits from ClassB.
- The generic type argument that you use to pass to ClassB is defined in any project that is a file reference in Project 1.Note This project can be Project C itself.
- You make a call to such a class from Project 1.
To resolve this problem, modify the reference to Project A that is in Project 2. To do this, make the reference a project reference instead of a file reference.
Note Because this bug applies only to a very specific scenario, it is unlikely that you will experience this problem.
This issue occurs when the Visual Studio 2008 solution has the structure that is mentioned in the "Cause" section and that is illustrated in the following diagram:
Article ID: 945425 - Last Review: 12/07/2007 16:13:00 - Revision: 1.1
Microsoft Visual Studio 2008 Standard Edition, Microsoft Visual Studio 2008 Professional Edition, Microsoft Visual Studio Team System 2008 Database Edition, Microsoft Visual Studio Team System 2008 Architecture Edition, Microsoft Visual Studio Team System 2008 Development Edition, Microsoft Visual Studio Team System 2008 Test Edition, Microsoft Visual Studio Team System 2008 Team Suite, Microsoft Visual Basic 2008 Express Edition
- kbtshoot kbgraphxlink kbprb kbdevelopment KB945425