Microsoft KB Archive/315473

= BUG: The Visual Studio .NET IDE stops responding with too many classes in one .cs file =

Article ID: 315473

Article Last Modified on 7/29/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-



This article was previously published under Q315473



SYMPTOMS
If you add too many classes (for example, approximately 1,000) in a single C# (.cs) file while the file is open in the Visual Studio .NET Integrated Development Environment (IDE), the IDE may appear to stop responding (hang).



CAUSE
This behavior can occur because the IDE may take a long time to parse the source code in the open .cs file.



RESOLUTION
To work around this issue, use one or more of the following methods, as necessary:
 * In the IDE, click Options on the Tools menu. In the Options window, expand the Text Editor node, expand the C# node, and then select the Formatting node. In the right pane, click to clear the Automatically format completed constructs and pasted source check box, and then click OK.If the .cs file is open in the IDE, close the file. (You do not have to close the project.) Open the .cs file in Notepad. Add the classes, save the file, and then quit Notepad. You can now open the modified .cs file in the IDE.Do not put too many classes in one single .cs file while the file is open in the IDE. Separate the classes into different .cs files.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Problem
 Create a new C# console application project in the Visual Studio .NET IDE.  Start Notepad, and then add the following source code: class a1 { int i; } class a2 { int i;

} Repeat the preceding definition for classes a3 to a998. Then, add the following classes to complete the 1,000 classes: class a999 { int i; } class a1000 { int i; }  Go to the console application project in the IDE. Open the Class1.cs file. Copy all of the source code from the Notepad window, and then paste it into the Class1.cs file in the section preceding class &quot;Class1&quot; and the first curly brace ({) after &quot;namespace&quot;. Note that the IDE appears to stop responding.

Keywords: kbbug kbnofix kbvs2002sp1sweep KB315473

-

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

© Microsoft Corporation. All rights reserved.