Attempted to Read or Write Protected Memory. This Is Often an Indication That Other Memory Is Corrupt

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

Finally tracked this down with the help of WinDBG and SOS. Access violation was being thrown by some unknown DLL. Turns out a piece of software called "Nvidia Network Manager" was causing the problems. I'd read countless times how this issue can be caused by firewalls or antivirus, neither of which I am using so I dismissed this idea. Also, I was under the assumption that it was not environmental because it occurs on more than 1 server using different hardware. Turns out all the machines I tested this on were running "NVidia Network Manager". I believe it installs with the rest of the motherboard drivers.

Hopefully this helps someone as this issue was plaguing my application for a very long time.

VB.Net in Visual Studio 2015 - Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

I succeeded with a brute force workaround. I discovered that the problem happened if I selected the troublesome item from the ListView without first having selected any other items from the ListView which didn't cause the problem. So, the solution was somehow to select an item which didn't cause the problem before selecting one that did. How would I know which one I could select that wouldn't cause the problem? Also, if there were only one item in the list, what could I do then?

The solution was to create a dummy document and always load it first.

As before, the user selects a category that populates the ListView (lvwDocuments), which displays the coversheets that represent the scan sets. Now, however, before those coversheets are loaded into the list, an item is loaded that represents the dummy coversheet. (The first item in the list is the dummy coversheet and the rest are valid items for the category selected.) Based on that dummy item as the first item in the list, I load the dummy document onto a tab in the tabControl (tcDocumentScanInstances). I delete the dummy coversheet item from the ListView (lvwDocuments) and hide the dummy document on the tab with a panel that displays a message telling the user that scan instances will appear in tabs when a coversheet item is selected. (Surprisingly, it actually looks better than the interface I had before and the message does not seem unnecessary or out of place!) The user never sees dummy item in the list as it is loaded and deleted so quickly.

There you have it. From what I found when searching for a solution, there seem to be so many different situations in which this error occurs. I wish I knew a better way to prevent this, a way that could be applied to other situations, as well. This solution works for me in this instance. I hope it helps someone somehow.

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

You are using a lambda as a thread function. This lambda is called on a new thread. At the
moment the thread is actually created, it will look for the argument you supply, which is a local variable srUrl, but by the time this happens your function (dispatcherTimer_Tick) has already exited, so srUrl will be in a part of the stack that is no longer properly defined (hence the access violation). The easy fix is to define a variable in the class and stuff the srLoc there quickly. A more proper solution is to actually pass the srLoc as argument:

() =>
{
startNewWindow(srUrl);
}

becomes

(Action<string>){x => {startNewWindow(x);},
new object[] {srUrl}

Now the function reference and a proper copy of the string are saved for the function call, and it doesn't matter that the original srUrl is out of scope by the time the thread kicks in. I'm not sure whether the task factory allows the argument array to be passed. dispatchers normally have an overload for this, so maybe you want to let your window take care of this.

Now you actually do this a few times, so you may need to wrap the arguments each time they are passed.

ASP .NET Error when redirect to another page: Attempted to read or write protected memory. This is often an indication that other memory is corrupt

I tried to run my application without enter my windows 10 pro key (so i running with windows 10 home) it's worked. the bug is disappear. may be something going wrong with my windows update or else.



Related Topics



Leave a reply



Submit