banner



Visual Studio Attempted to Read or Write Protected Memory

 Wierd mistake : Attempted to read or write protected retentivity. This is ofttimes an indication that other retentivity is corrupt
Author Message
Mike Martin24365


PostPosted: Visual C# General, Wierd mistake : Attempted to read or write protected memory. This is often an indication that other memory is corrupt Meridian

Ok I accept a project that runs fine from the IDE, the problem is if I install the app or run it from the bin\release binder then I go this error on i of my method calls. I accept tried this on a test automobile and on my development machine and the results are the same. I take spent hours trying to figure this 1 out....... The crazy thing is, the method shows upwards in the stack trace but in that location is not code at all executed in that method.

Visual C#thirteen

 
ivolved


PostPosted: Visual C# General, Wierd error : Attempted to read or write protected memory. This is oft an indication that other memory is corrupt Height

Ok I accept a project that runs fine from the IDE, the problem is if I install the app or run information technology from the bin\release folder then I become this error on one of my method calls. I have tried this on a test machine and on my development car and the results are the same. I have spent hours trying to figure this 1 out....... The crazy thing is, the method shows upward in the stack trace merely there is non code at all executed in that method.

This shouldn't happen in managed code. It's even odder that the error only happens when not debugging. Tin can you give the code for the method that causes the trouble

Michael

RCroft


PostPosted: Visual C# Full general, Wierd error : Attempted to read or write protected memory. This is frequently an indication that other memory is corrupt Top

I get the exact aforementioned error on startup of MS Outlook w/ business organisation contact manager. In my quest to find out what was causing information technology, I stumbled upon your post. No other apps running, sys is Dell XPS two laptop w/ MS office 2003. The problem makes Outlook unusable. I'1000 guessing the programme or system is ordering the executing of a write command faster than the retentivity is released

Delight note that I know very little virtually the inner working of software, and I'thousand sure information technology shows!

Best of luck,

RC


DomiS


PostPosted: Visual C# General, Wierd mistake : Attempted to read or write protected memory. This is oft an indication that other retentivity is decadent Top

I've got the same trouble with my own developed Programm!
Information technology runs fine when pressing the "Start Debugging"-Button in Visual Studio 2005, but this error occurs, when I run it from command line.
Besides VS 2005 Retail (no Beta!) the .NET framework two.0 is installed, and the organization is upwardly to engagement (all updates from update.microsoft.com).

In my programm I've got two Event-Handler running side by side in their own threads. One Event-Handler gets active when at that place is data on the series port (using Arrangement.IO.Ports) and the other is a SNMP-Trap-Handler which I've rewritten in VB.Cyberspace from a C#-example. This SNMP-Trap-Handler uses a .Internet-interoperability-course which is needed to use the unmanaged lawmaking that the wsnmp32.dll from windows provides!

The SNMP-Issue-handler, which I have rewritten in VB.NET, lonely does run perfect, only like when the combinated programm is startet within Visual Studio, as I said earlier.

It seems to me, that the programm always aborts, when the SNMP-Handler gets active. If I but crusade some serial data events, the programm runs just fine, even when started from command-line.
So I would expect the error inside SNMP-Trap-Handler code, if asked!
Only why does the programm run fine from within Visual Studio I accept no thought!!!

Here is a link to that guy who adult the interoperability class und likewise the C#-snmp-trap-handler: http://dotnet.sys-con.com/read/38936.htm

Maybe just ane pocket-sized update:
I accept tested the programm with the original C# snmp-handler just to see if I made a mistake when rewriting it in VB.NET, but the trouble is the same here.

I compiled the original trap-handler.cs file to a dll. A added this dll as a refernce to my other programm which handles the serial events and runs the main.
When I debug this in Visual Studio the programm runs fine once again, just like it is supposed to. Merely when I starting time it from command line, I have the same problem:

Unhandled Exception: System.AccessViolationException: Attempted to read or write
 protected memory. This is often an indication that other retention is corrupt.

I have no doubt what's going wrong!
What'due south the difference between running from command line and starting it from within Visual Studio


Mike Martin


PostPosted: Visual C# General, Wierd fault : Attempted to read or write protected memory. This is often an indication that other retention is decadent Peak

ok, simply an update on what I found. I had the following in a method

10=(variableA+variableB+ anothermathfunction(variableC,variableD));

what I changed that fixed my problem:

y= anothermathfunction(variableC,variableD);

x=(variableA+variableB+ y);

Now I cant explicate this only subsequently HOURS of trial and error this fixed my problem.

Good Luck......


ivolved


PostPosted: Visual C# General, Wierd mistake : Attempted to read or write protected memory. This is often an indication that other retention is corrupt Meridian

ok, just an update on what I found. I had the following in a method

x=(variableA+variableB+ anothermathfunction(variableC,variableD));

what I changed that stock-still my problem:

y= anothermathfunction(variableC,variableD);

x=(variableA+variableB+ y);

At present I cant explicate this merely after HOURS of trial and mistake this fixed my problem.

Skillful Luck......

Odd. Is your application multi-threaded What does anothermathfunction exercise

DomiS


PostPosted: Visual C# General, Wierd error : Attempted to read or write protected memory. This is often an indication that other memory is corrupt Pinnacle

Howdy again,

unfortunatelly your solution didn't assistance me with my problem, merely information technology lead me to my own solution.
I told a colleague what y'all posted and he suggested, that those problems might be caused by bad compiler optimizations!
And then I searched Visual Studio and found out that you can turn off compiler optimizations in "Properties/Compile/Advancec Compile Options" of the program.

At present my program seems to run fine, cheers! :)


DejanR


PostPosted: Visual C# General, Wierd error : Attempted to read or write protected memory. This is oftentimes an indication that other retention is corrupt Pinnacle

You should gear up you De**** in VS2005:

Tools->Options

Debugging->General

uncheck selection "Suppress JIT optimization on module load"


DomiS


PostPosted: Visual C# Full general, Wierd error : Attempted to read or write protected memory. This is frequently an indication that other memory is corrupt Top

Thank you, I will effort that!

Drew Noakes


PostPosted: Visual C# Full general, Wierd fault : Attempted to read or write protected memory. This is often an indication that other memory is corrupt Top

Cheers for your suggestion, however this didn't help me in my case.

I'm seeing this exception when calling an extern method on a COM DLL.

Information technology'due south nonetheless early-days for my debugging, simply it's quite frustrating. This worked fine with VS 2003, and I'g only seeing it at present I try to upgrade.

Fingers crossed!


Sossles


PostPosted: Visual C# General, Wierd error : Attempted to read or write protected memory. This is ofttimes an indication that other memory is corrupt Height

I had the verbal same bulletin when running my company'due south application, written in VS2003, on a new auto with only VS2005 installed. When I installed the .Internet v1.1 runtime, the trouble went away. I too saw it on another application, in that example I had to actually provide a config file for the EXE to brand information technology run inside the v1.1 runtime, but again that fixed it.

Steve.


krhyzsy


PostPosted: Visual C# Full general, Wierd error : Attempted to read or write protected memory. This is often an indication that other memory is corrupt Top

i have a very close similiraty with your prob..and am not getting any solutions yet..if u have already resolved yours, i would very much appreciate information technology if y'all mail service information technology here..so that i may likewise refer:)..thanx
krhyzsy


PostPosted: Visual C# General, Wierd error : Attempted to read or write protected retention. This is often an indication that other memory is decadent Top

You should set you De**** in VS2005:

Tools->Options

Debugging->Full general

uncheck selection "Suppress JIT optimization on module load"

am using VS2005 and i tin can't seem to follow this navigations..or are u missing something

Matthew Watson


PostPosted: Visual C# General, Wierd error : Attempted to read or write protected memory. This is ofttimes an indication that other memory is decadent Top

I can come across that selection ok (using VS2005).

Wardog


PostPosted: Visual C# Full general, Wierd fault : Attempted to read or write protected retentivity. This is ofttimes an indication that other memory is corrupt Top

I was having the aforementioned problem when trying to instantiate a FoxPro .dll in my VS2005.cyberspace web application on the production server. My problem was in the COM .dll itself using a variable GETENV("TEMP").

The problem is that the spider web app was running equally a user via the IIS Application Pooling and the GETENV("TEMP") variable was pointing to an environment variable that didn't exist (bad path)

My communication to you lot is to search your COM .dll with a fine-toothed comb and look at variables/paths that dont jive from client side testing to production server testing.

Good Luck!


vanraalteblat1999.blogspot.com

Source: http://www.databaseforum.info/2/639319.aspx

0 Response to "Visual Studio Attempted to Read or Write Protected Memory"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel