Microsoft KB Archive/833895

= BUG: The values that appear in the Watch window are not correct When you add a member of a Hashtable class to the Watch window in Visual Studio .NET or in Visual Studio 2005 =

Article ID: 833895

Article Last Modified on 4/29/2007

-

APPLIES TO


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

-



SYMPTOMS
In an application that was created in Microsoft Visual Studio .NET or in Microsoft Visual Studio 2005, if you drag a member of a Hashtable class to a Watch window to add a new Watch, the nodes that appear for the key-and-value pairs should contain the key-and-value pairs. However, these nodes are empty.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.



Steps to reproduce the behavior
 Start Visual Studio .NET 2003 or Visual Studio 2005. On the File menu, point to New, and then click Project.

The New Project dialog box appears. Under Project Types, click Visual Basic Projects.

Note In Visual Studio 2005, click Visual Basic. Under Templates, click Console Application. In the Location box, type C:\.

Note  is a placeholder for the name of the folder where you want to save your application project. In the Name box, type SampleConsoleApplication for the name of your application project, and then click OK. By default, the Module1.vb file is created.  Paste the following code in the Sub Main procedure. Dim x As New Hashtable x.Add(&quot;a&quot;, 1) x.Add(&quot;b&quot;, 1) Stop </li> Set the Startup Object property for the project before you run the application. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> On the Project menu, point to SampleConsoleApplication Properties.

The SampleConsoleApplication Property Pages dialog box appears.</li> Under Startup Object, click Sub Main, and then click OK.</li></ol> </li> On the Debug menu, Click Start.</li> On the Debug menu, point to Windows, point to Watch, and then click Watch1.</li> Add the X object that the code defines to the Watch1 window. To do this, click in the Watch1 window, type x, and then press TAB.</li> Expand X. Notice that the (0) node and the (1) node appear under the X node in the Watch1 window.</li> Drag the (0) node to the X node. Notice that the x.buckets(0) node is added to the Watch1 window.</li> Expand x.buckets(0). Notice that the two nodes under x.buckets(0) are empty.</li> Drag the (1) node to the X node. Notice that the x.buckets(1) node is added to the Watch1 window.</li> Expand x.buckets(1). Notice that the two nodes under x.buckets(1) are not empty.</li></ol>

<div class="references_section">