locked
Sync. Framework: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. RRS feed

  • Question

  • Hi there!

    Trying to run the following code:

                // Create or open the metadata store, initializing it with 
                // the flexible ID formats we'll use to reference our items and endpoints.
                if (!File.Exists(file))
                {
                    _metadataStore = SqlCeMetadataStore.CreateStore(file);
                    _metadata = _metadataStore.InitializeReplicaMetadata(_idFormats, _replicaID, null, null);
                }
                else
                {
                    _metadataStore = SqlCeMetadataStore.OpenStore(file);
                    _metadata = _metadataStore.GetReplicaMetadata(_idFormats, _replicaID);
                }


    Gives me error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

    Any ideas
     
    Regards
    Christian
    • Moved by Max Wang_1983 Friday, April 22, 2011 6:45 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, July 28, 2008 2:10 PM

Answers

All replies

  • Hi Christian -

     

    Do you have a debugger attached? That should tell you which statement above is throwing the error. Also, do you happen to be running this code on a device or device emulator?

     

    Thanks
    Deepa

    Monday, July 28, 2008 8:38 PM
    Answerer
  • Hi Deepa -

    Nop, I am not running on a device. The code is example is from the sync. Framework. The code is from: http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=949

     

    Thanks

    Christian

     

     

    Tuesday, July 29, 2008 8:12 AM
  • Chris,

     

    I downloaded the sync framework CTP2 bits, installed it and run the sample on my machine and didn't see the problem happen. I am suspecting maybe the framework setup had some trouble on your machine.

     

    Could you try to uninstall/reinstall the sync framework and run the sample again?

    If the AV still happens, please check which statement causes it.

     

    thanks

    Tuesday, July 29, 2008 6:59 PM
    Answerer
  • Hi Christian -

     

    I suspect that you either have an incorrect or a corrupted framework. Can you ensure that you have the correct framework from

    http://www.microsoft.com/downloads/details.aspx?FamilyId=C88BA2D1-CEF3-4149-B301-9B056E7FB1E6&displaylang=en#Overview

     

    Also, a requirement to run the first sample if SQL Server Compact Edition which we install - it is possible that you may have uninstalled it by mistake. Reinstalling the framework should fix that as well.

     

    Thanks
    Deepa

     

    Tuesday, July 29, 2008 7:03 PM
    Answerer
  •  

    Thanks Deepa!

     

    Worked after reinstalling!

     

    Regards

    Christian

    Wednesday, July 30, 2008 8:21 AM