Friday, November 11, 2011

How to fix the Visual Studio Exception: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

What?


How to fix the Visual Studio Exception: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Why?

Visual Studio (2010 in my case) throws an exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

I received this exception whenever I tried to debug even a basic solution. That means an empty Visual Studio solution using "ASP.NET 3.5 Website Project" template.


I tried changing target framework from 3.5 to to 2.0 but that did not help. I thought this error could be due to a corrupted installation of Visual Studio 2010. So I attempted to repair it. That did not fix the issue. I then installed  Visual Studio 2010 SP1. That has not helped either.

How?


Finally the below procedure fixed the issue:

Open Visual Studio and click on the menu item "Window". Then click "Reset Window Layout" as shown below:



Visual Studio does not throw the exception anymore.

1 comment:

  1. I have also Visual Studio 2010 SP1 installed but "reset window layout" did not solve the problem.

    I encounter the crash whenever I open two config files at the same time.(app.config and web.config).

    ReplyDelete