I\'ve started seeing an AccessViolationException being thrown in my application a several different spots. It never occured on my development pc, our test server. It also o
Hi There are two possible reasons.
We have un-managed code and we are calling it from managed code. that is preventing to run this code. try running these commands and restart your pc
cmd: netsh winsock reset
open cmd.exe
and run command "netsh winsock reset catalog"
In my case fonts used in one of the shared library was not installed in the system.
In my case I had trouble with the "Environment variables" while adding reference to my COM DLL.
When I added the reference to my project, I was looking for P:\Core path, whereas I had added the c:\core path in past into path environment varaible.
So my code was attempting wrong path first. I removed that and un-registered the DLL reference and re-registered my DLL reference using (regsvr32). Hope this helps.
Microsoft also released a hotfix (July 2nd, 2007) to prevent the error "Attempted to read or write protected memory" that has been plaguing the .NET 2.0 platform for some time now. Look at http://support.microsoft.com/kb/923028 - not sure if it applies to you, but thought you might like to check it out.
The problem may be due to mixed build platforms DLLs in the project. i.e You build your project to Any CPU but have some DLLs in the project already built for x86 platform. These will cause random crashes because of different memory mapping of 32bit and 64bit architecture. If all the DLLs are built for one platform the problem can be solved. For safety try bulinding for 32bit x86 architecture because it is the most compatible.
For VS 2013, .NET Framework 4.5.1 also has a AccessViolationException bug (KB2915689) when dealing with SQL Server / TCP Sockets. Upgrading to .NET Framework 4.5.2 corrects this problem.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.