Exception Microsoft.Office.Interop.Excel System.RuntimeType.ForwardCallToInvokeMember RRS feed

  • Question

  • Hello,

    I'm having an crash with Excel 2016, using Microsoft.Office.Interop.Excel

    Our app copies the dll onto the app folder, and doesn't use the latest version of this dll.

    When I look at our csproj, the reference is but the dll used is

    The exception stack is:

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

    Call Stack:    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)

       at Microsoft.Office.Interop.Excel.Range.set_Value(Object RangeValueDataType, Object value)

    It is a random crash, which can happen with the first workbook opened of the day, or late in the day.

    Are you aware of problems with this version ?

    Knowing that our users manipulates big worksheets.

    I've never been able to reproduce it myself.

    Don't hesitate to ask me some more details.



    Thursday, June 8, 2017 7:59 AM

All replies

  • Hi Valgoku,

    if you are working with multiple versions of office then you can try to use Late binding.

    Late binding

    In contrast to early binding, late binding waits until run time to bind property and method calls to their objects. To do this, the target object must implement a special COM interface: IDispatch. The IDispatch::GetIDsOfNames method allows Visual C# to interrogate an object about what methods and properties it supports and the IDispatch::Invoke method then allows Visual C# to call those methods and properties. Late binding in this fashion has the advantage of removing some of the version dependencies that are inherent with early binding. However, it has the disadvantages of removing compile-time checks on the integrity of automation code, as well as not providing Intellisense features that can provide clues to correct calls to methods and properties.


    Binding for Office automation servers with Visual C# .NET

    How to use two versions of MS Office Interop Assemblies in a C# Application? RSS



    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

    Friday, June 9, 2017 6:49 AM
  • Thank you for this reply, useful information !

    When the problem will be solved I will complete the thread with my answer !

    Monday, October 30, 2017 3:50 PM