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

    General discussion

  • I am getting System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt at belwo code at &fileOpenException. AnyHelp..

    FileObjectTmp.Open( m_ShortsCache_FileName, CFile::modeReadWrite | CFile::shareDenyNone, &fileOpenException ) )

    Friday, December 28, 2012 9:50 AM

All replies

  • Show us the definition of m_ShortsCache_Filename and it acquires a value (initialization or assignment).
    Friday, December 28, 2012 8:17 PM
  • Declaration: CString          m_ShortsCache_FileName;   // This is set during Serialize() using the CArchive filename.

    m_ShortsCache_FileName   = pFileArchive->GetFilePath();

    Sunday, December 30, 2012 6:53 AM
  • What is the value of m_ShortsCache_FileName at the moment CFile::Open() is called? Is it NULL by any chance?
    Sunday, December 30, 2012 5:10 PM
  • Perhaps you need to verify that both GetFilePath() and Serialize() succeeded and returned a value valid for your intended use.
    Sunday, December 30, 2012 5:19 PM
  • Hi,

    Thanks for your participation.

    We are changing the issue type to “General Discussion” because the currently posted information is not enough for retrieving a solution. If you have more time to look at the issue and provide more detailed information, please feel free to change the issue type back to “Question”. If the issue has been resolved, we will appreciate you sharing the solution because it might be a good reference for other community members encountering similar questions.

    Regards,


    Damon Zheng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 08, 2013 9:13 AM
    Moderator