Contact Sales: +1-888-365-2779
Community & Support
Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / General, Installation, Licensing / Error message: "Attempted to read or write protected memory."

Error message: "Attempted to read or write protected memory."

Article Info

Rating: 3

 

Article information

Article relates to

RadControls Q1 2006

Created by

Robert, Telerik

Last modified

May 16, 2008

Last modified by

Rumen, Telerik


 
ERROR MESSAGE
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

DESCRIPTION 
The image “http://www.telerik.com/images/editor/SuiteLogo.gif” cannot be displayed, because it contains errors.
This error is not directly related to Telerik controls but occurs when trying to drop a Telerik control from the VS toolbox onto the designer workspace and then the file is checked out using SourceGear or SourceSafe.

Telerik was first contacted with this problem during VS2005's beta stage but the exception is related to machines with any VS2005 installation which works in conjunction with either SourceSafe or SourceGear Vault. Our research shows that it is caused by an AccessViolationException thrown by VS.NET. Such exceptions occur when a .NET program uses P/Invoke to call native methods (COM objects or DLL-exported methods). No Telerik control does that. 

So far we have found the following reasons for the exception:

  • configuration/installation problems of the framework, VS.NET and/or SourceSafe/SourceGear (usually the SourceSafe/SourceGear installation is corrupted). Restarting of VS, IIS or the machine does not help;
  • running 32-bit code which tries to call 64-bit one and vice versa (this appears on 64bit machines, i.e. 64-bit CPU, Windows or .NET 2.0 version).

SOLUTIONS
This error message is still being investigated and other solutions may exist. In case you are able to fix the problem in some other way than the described below, please let us know, so that we can update the article.

  1. Try creating a new project - you should be able to use the Telerik controls in that project.
  2. If you are still using the beta version of VS2005, update to the latest official version and try again.
  3. A webserver with multiple worker processes may cause this inconsistency. The problem should disappear once the number of worker processes is set to 1.
  4. Ensure that the VS.NET addin works in SourceSafe/SourceGear works. You can do that by checking files in and out of your repository (try checking out a page before dropping a control and see if it works). Try uninstalling all copies of VSS that you may have on your machine and install the latest version only.
  5. If you use the 64bit version of .Net2, then review this Microsoft support article on switching from .NET1.x 32bit to .NET2 64bit: http://support.microsoft.com/default.aspx?scid=kb;en-us;894435, more importantly the ASP.NET 2.0, 32-bit version section and setting the 64bit Web Service to Prohibited.
  6. Simply copy and paste the controls' DLLs and XML files into the bin directory.
  7. If none of the above works, you may consider reinstalling the machine.


This problem cannot be observed with RadControls for ASP.NET AJAX

 

Comments

  • shimon , Aug 21, 2007

    This worked for me: I deleted the *.sln and *.suo files and open the website. The error did NOT show afterwards. Good luck

  • wdudek , Aug 30, 2007

    I followed a similiar path as shimon and was able to get things working again. I deleted all my source code and did a get latest from source control. It seems that somethign in the visual studio files gets corrupted and causes the problem.

  • Doug Odegaard , Dec 4, 2007

    Worked for me as well. VSS is not involved at all. Once I opened the website and not the solution all was well.

  • Mark , Mar 31, 2008

    I have multiple web sites beneath a single solution. New sites would throw this error when adding a rad control. I opened the web site directly (not through the solution) and was able to drop rad controls into the site no problem. After doing that I was once again able to use the site normally through the parent solution. It's as though it didn't have permission through the solution to write the dlls into the bin folder.

  • Ben , Dec 12, 2008

    You may also try turning DEP off for VisualStudio. Sometimes DEP will prevent access to memory locations it thinks should not have executables in them.

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.