Microsoft KB Archive/319837

= FIX: Old address in Memory window may cause unhandled exception in Visual Studio .NET =

Article ID: 319837

Article Last Modified on 8/29/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft .NET Framework 1.0 Service Pack 1

-



This article was previously published under Q319837



SYMPTOMS
When you debug a managed application, a memory address that is left in the Memory window from a previous debug session may cause the debugger to generate an unhandled exception. This problem only occurs in managed applications if the expression that is left in the Memory window is a  +   expression.



RESOLUTION
If the debugger does not generate an unhandled exception immediately when you start the debugger, follow these steps to work around this problem:
 * 1) Press F10 to step into Main.
 * 2) Set the expression in the Memory window to 0.
 * 3) Press F10 again to continue stepping through your code.

If the exception occurs immediately when you start the debugger, try to create a new Microsoft Visual C# .NET or Microsoft Visual Basic .NET Console Application project, and then reset the garbage value in the Address box of the Memory window by using this project:
 * 1) Create a new default Visual C# .NET or Visual Basic .NET Console Application project.
 * 2) Press F10 to step into Main.
 * 3) Set the expression in the Memory window to 0.
 * 4) Stop debugging. This clears the old value that was causing the problem in the Address box of the Memory window.
 * 5) Load your original project that causes the exception, and then step through the code.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in all versions of Microsoft Visual Studio .NET (2003).



Steps to Reproduce the Behavior
 Create a new Visual C# .NET Console Application project. Note that you can also reproduce the behavior with a Visual Basic .NET application.  Add the following function to the application: static void TestMemoryWindow {    Console.WriteLine(&quot;Testing&quot;); }                    Call TestMemoryWindow in Main. Build the application and press F10 to start debugging. The application breaks at the call to TestMemoryWindow. Press F11 to step into the TestMemoryWindow function. On the Debug menu, point to Windows, click Memory, and then click Memory1 to open the Memory window. You can open any of the four Memory windows.</li> Type the following in the Address box:

TestMemoryWindow + 12

</li> Press ENTER.</li> Stop the debugger.</li> Press F10 to start debugging.</li> Press F10 again. This will cause an unhandled exception.</li></ol>

Keywords: kbbug kbfix kbdebug kbvs2002sp1sweep KB319837

-

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

© Microsoft Corporation. All rights reserved.