Lines of code may be missing if you compile a solution that has a complex project structure in Visual Studio 2008

Article translations Article translations
Article ID: 945425 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

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.

Notes
  • 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.

CAUSE

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.

    Notes
  • 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 problem may occur at the point at which you define ClassC if the following conditions are true:
  • 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.

RESOLUTION

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.

MORE INFORMATION

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:
Collapse this imageExpand this image
Diamond Reference

Properties

Article ID: 945425 - Last Review: December 7, 2007 - Revision: 1.1
APPLIES TO
  • 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
Keywords: 
kbtshoot kbgraphxlink kbprb kbdevelopment KB945425

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com