Microsoft KB Archive/945425

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

Article ID: 945425

Article Last Modified on 12/7/2007

-

APPLIES TO


 * Microsoft Visual Studio 2008 Standard Edition
 * Microsoft Visual Studio 2008 Professional Edition
 * Microsoft Visual Studio 2008 Team Edition for Database Professionals
 * Microsoft Visual Studio 2008 Team Edition for Software Architects
 * Microsoft Visual Studio 2008 Team Edition for Software Developers
 * Microsoft Visual Studio 2008 Team Edition for Software Testers
 * Microsoft Visual Studio 2008 Team Suite
 * Microsoft Visual Basic 2008 Express Edition

-



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 &quot;Cause&quot; 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  For more information about project references, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ez524kew(VS.80).aspx

 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.</li></ul>

Note To view a diagram of this structure, see the &quot;More Information&quot; 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.

</li> You make a call to such a class from Project 1.</li></ul>

<div class="resolution_section">

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.

<div class="moreinformation_section">

MORE INFORMATION
This issue occurs when the Visual Studio 2008 solution has the structure that is mentioned in the &quot;Cause&quot; section and that is illustrated in the following diagram:



Keywords: kbdevelopment kbgraphxlink kbtshoot kbprb KB945425

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.