Attempted to read or write protected memory. This is often an indication that other memory is corrupted
<p>I am working on a Project which works fine while i was using .NET Framework 3.5 but later I used Framework 4.0. It was working fine. But however sometime I got following error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I even try to catch Exception using try catch but still it didn't catch the exception. I am not sure why this is happening. Is there any problem in FrameWork 4.0? Can any one suggest me. I try different things like</p>

<ol>
<li><p>Tools menu ->Options -> Debugging -> General -> Uncheck this option "Suppress JIT optimization on module load"</p></li>
<li><p>Download Hotfixes of microsoft for .Net Framework 4.0 and so on. But still I couldn't resolved this issue.. Can some one suggest </p></li>
</ol>

<hr>

<pre><code>protected override bool ConcreteExecute()
{
    using (BusinessLogic.GUI.VersionsForm dlg = new BusinessLogic.GUI.VersionsForm(_infoItems[0]))
    {
        try
        {
            dlg.ShowDialog(); &lt;= AccessViolation Exception comes from here but didn't catch
        }
        catch (AccessViolationException ex)
        {

        }
    }

    return true;
}
</code></pre>
