none
word add-in fails to load dll RRS feed

  • Question


  • Hi,

    I have problem with MS Word add-in, hope this forum can help to solve the problem or give me some input. Thanks in advance.

    I have two word-addins.

    The first one is developed using C++, it has 2 dll (let say A.dll and B.dll). The A.dll is the main add-in dll, it depends on B.dll. A.dll hooks to save-document event. It executes certain logic, which will load B.dll, when active document is saved.

    The second dll (a new dll) is developed using VSTO. The dll is a simple add-in with one ribbon button to save an active document.

    The both add-ins are installed in different folders.

    When I click the ribbon button from second add-in to save active document, the first add-in code is executed and when it needs B.dll I got 'System.IO.FileNotFoundException'.

    I notice the first dll is loaded from its location but the second dll is loaded from shadow copy location (c:\users\..\appdata\..).

    The exception it comes from the second add-in which has nothing to do with B.dll or A.dll. Why is it happening? How to fix this problem?

    If I perform save operation from MS Word menu, the first add-in doesn’t have problem.

    Thanks for your help.


    sk

    Friday, September 27, 2013 2:07 PM

All replies

  • Hi,

    Thank you for posting in the MSDN Forum.
    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!
    Best regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, September 30, 2013 8:28 AM
    Moderator
  • Hi sk,

    >> The exception it comes from the second add-in which has nothing to do with B.dll or A.dll. Why is it happening? How to fix this problem? <<

    The figure below explained why the C++ exception is caught by .NET code.

    My guess is that the “file not found” exception is from the C++ Add-in (A.dll), to identify the root cause, would you please provide us some C++ code of save-document callback function in the A.dll (especially loading the B.dll part)?


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, October 1, 2013 8:53 AM
    Moderator
  • Hi,

    Thanks for reply. Please take the requested test program from 

    http://sdrv.ms/18RPbER

    I created to add-in: 

    1. word.zip : C# add-in with one button to save active document

    2. word_addin  : C++ add-in that listens to save event.

    Load first add-in, try the add-in. it works fine.

    Load second add-in, perform save operation from word (File->save). The second add-in works fine.

    Now load the first and second add-in together, perform save operation from first add-in ribbon button.  The MS Word will crash.

    If you debug the second add-in code, and put breakpoint at OnDocumentSave method, the crash because the add-in fails to load managed.

    Both add-ins are supposed to be independent, but somehow the first add-in causes problem to second add-in.   




    sk

    Thursday, October 3, 2013 9:54 AM