VSTO fails with Error "(System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt." RRS feed

  • Question

  • We have developed an Excel VSTO project using Framework 4.5. It refreshes Excel Tables and Pivots programmatically by connecting to SQL Server.

    Recently we are observing below Exception while refreshing a Pivot Table in an Excel File.

    (System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Refreshing an Excel 2016 Pivot Cache from c#.

    The data is refreshed in the Pivot. but then it hangs the Excel applications and crashed it.

    Details of the system where this issue is observed:

    Windows10, Excel 2016

    Earlier it was working fine with the same environment, but recently this issue is observed.

    Are there any updates made to Excel 2016 or OS, which is causing such behavior.

    Tuesday, August 1, 2017 12:08 PM

All replies

  • Hello,

    Would you get any error when you manually refresh the pivot tables?

    What code do you use now? Could you reproduce the issue for all Excel files? Could you reproduce the issue on other computers with same or different Office version?

    Since the issue occurs recently, do you have any Office update? What is your Office build version now?

    Please visit Version and build numbers of update channel releases to see the list of Office version and build number. Please check if you are using the latest version. If you are using the latest version, you could follow How to revert to an earlier version of Office 2013 or Office 2016 Click-to-Run  to revert to an earlier version to check if the issue would be fixed.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, August 2, 2017 2:07 AM
  • Hi Roman,

    Has your issue been resolved? If you have, it would be appreciated if you could share us the solution.

    If not, it would be helpful if you could share us a simple project and detail steps to reproduce your issue.



    Help each other

    Wednesday, August 9, 2017 6:13 AM