Attempted to read or write protected memory exception

73 views
Skip to first unread message

Brian Pierce

unread,
Nov 27, 2017, 12:01:35 PM11/27/17
to Excel-DNA
I am using ExcelDna 0.34.6 with Excel 2016 (32 bit). A sheet that was up and running suddenly displayed the following message while I was  not interacting with it:

    Runtime [Error] Unexpected error trying to run SyncMacro for queued macro execution. : TargetInvocationException - Exception has been thrown by the target of an invocation.

I closed the dialog box, and Excel continued to operate without issue. My logs captured the stack trace, which I've pasted below. I use QueueAsMacro to have Excel call my method that will check the values of cells in a range and set new values under certain conditions (it's a special case where this is needed; normally I just use an array formula to get values and avoid QueueAsMacro).

Has anybody else seen this? Is there anything I am doing that could be causing it? Should I be concerned about letting Excel continue to run after closing the dialog box?

Thanks for any insights anybody has.

Brian


Here's the stack trace:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at ExcelDna.Loader.XlCallImpl.TryExcelImpl12(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Loader.XlCallImpl.TryExcelImpl(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Integration.ExcelIntegration.TryExcelImpl(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Integration.XlCall.TryExcel(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Integration.XlCall.Excel(Int32 xlFunction, Object[] parameters)
   at ExcelDna.Integration.ExcelReference.GetValue()
   at <...my method that gets cells values and may set them...>
   at UpTick.UpTickXL.AddIn.PasteMethodLogic.<>c__DisplayClass6_0.<PasteData>b__0()
   at ExcelDna.Integration.ExcelAsyncUtil.<>c__DisplayClass7_0.<QueueAsMacro>b__0(Object <p0>)
   at ExcelDna.Integration.RunMacroSynchronization.SyncMacro(Double _unused_)
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
       at ExcelDna.Loader.XlCallImpl.TryExcelImpl12(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Loader.XlCallImpl.TryExcelImpl(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Integration.ExcelIntegration.TryExcelImpl(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Integration.XlCall.TryExcel(Int32 xlFunction, Object& result, Object[] parameters)
   at ExcelDna.Integration.XlCall.Excel(Int32 xlFunction, Object[] parameters)
   at ExcelDna.Integration.ExcelReference.GetValue()
   at <...my method that gets cells values and may set them...>
   at ExcelDna.Integration.ExcelAsyncUtil.<>c__DisplayClass7_0.<QueueAsMacro>b__0(Object <p0>)
   at ExcelDna.Integration.RunMacroSynchronization.SyncMacro(Double _unused_)

Reply all
Reply to author
Forward
0 new messages