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

Hi All,

I am working on winforms 2.0 with vs 2005 standard edition( windows Xp service pack 2). I am using enterprise library 3.0 caching application block for caching data .I used nullcache for caching storage type. I am using cached data particularly for to populate combobox data. When ever a screen which opened in my application having combobox that time I am storing all the data in caching as follows:

string cacheKey = key.ToString() + languageId.ToString();

dsLookupResourcesFromCache = (DataSet)cManager.GetData(cacheKey);

if (dsLookupResourcesFromCache !=null)

{return dsLookupResourcesFromCache;

}

else

{

HolcimBL.CommonBL cacheBL =newCommonBL();

dsLookupResourcesFromCache = cacheBL.GetLookupResources(languageId);

cManager.Add(cacheKey, dsLookupResourcesFromCache,CacheItemPriority.High,new HolcimUI.CommandDataCacheRefreshAction(),newSlidingTime(TimeSpan.FromMinutes(10)));

return dsLookupResourcesFromCache;

}

The above code will return the tables for all combobox in my forms.

In some of my screens I am adding new data and removing some old data for the comboboxes through other screens. When I insert new data

I am clearing the cache by using :

cManager.Flush();

and then again inserting the new data in the cache manager.

I closed the forms which inserted some data for the combobox datasource after that i am opening the forms which are having the comboboxes. In those forms i am getting the data with respect to the changes done in the data forms. But when I am changing the index for the comboboxes I am getting the exception like this:

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

Can anybody please give suggestions on this.

Lot of thanks.

[2644 byte] By [zoomer] at [2008-1-10]
# 1

Hi zoomer,

Could you please cover the exception in more details? You can post its stack trace, and inner exception here.

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thanks!

FengChen-MSFT at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 2

Hi zoomer,

We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Thank you!

FengChen-MSFT at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...

.NET Development

Site Classified