none
Excel Add-In contention with other Add-Ins using messaging RRS feed

  • Question

  • I am having trouble with an Excel Add-In - or more accurately, our app appears to be causing problems with other Excel Add-Ins that use messaging.  If our Add-In and another Add-In that is using messaging are both enabled at Excel start up, then messaging in the other app does not work.  If, however, our app is disabled at Excel start up, and then manually enabled, everything works fine (at least until Excel is stopped and started). This has been reported with multiple add-ins. I have recreated the issue with Microsoft PowerQuery. We are almost certainly doing something wrong, I am just not certain how to fix it.

    I had a discussion with one of the other Add-In developers, and they believe the issue is with our use of app domains.  We are using ExcelDNA, and one of the features of ExcelDNA is that it will run everything in an app domain. When I run in debug mode, it shows everything getting created in our own app domain, so it appears to be working.  They of course can't show me their code, and I can't show them ours, and the problem occurs when running their app, so it makes debugging for me a lot harder.

    We are using messaging, with the System.Runtime.Remoting.Messaging library. I have been sent a link that indicates that we should be using IMessageFilter instead: 

    https://blogs.msdn.microsoft.com/andreww/2008/11/19/implementing-imessagefilter-in-an-office-add-in/.

    I haven't implemented this, but I have however yanked all of the code and references out that use the System.Runtime.Remoting.Messaging library.  Our app can't run like this of course, but the problem is that the other add-ins are still broken if our app is enabled at Excel start up.

    One final tidbit - when I recreate the problem with our add-in and PowerQuery, I see all of our stuff being created in our own app domain.  But PowerQuery appears to create everything in DefaultDomain.  So perhaps PowerQuery is the problem?

    I am happy to provide any documentation I am able to, I just don't know what information would be helpful at this point.

    Thanks,

    Huck

    Monday, May 9, 2016 3:47 PM

All replies

  • Hi Huck,

    >> So perhaps PowerQuery is the problem?

    If you disable PowerQuery, will your add in and other add in work correctly, or if you disable your add in, will PowerQuery and other add in work correctly?

    Based on your description, you assume your issue is related with messaging, am I right? To narrow down this issue, I suggest you comment out the part code which is related with messaging to check whether this issue still exist.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, May 10, 2016 1:52 AM
  • Thanks for the reply Edward.  If I disable Power Query, then our Add-In works correctly, and vice versa.  I can't install the other Add-In to test this, they will not give me a license for it (we are basically competitors, we won't give them a license for ours either).  As I mentioned in the original post, I have yanked out all of the code and references to System.Runtime.Remoting.Messaging, and the problem persists.  I don't know what else we could be doing that would be messing up their messaging.  They claim to be using messaging as described in the post I mentioned about IMessageFilter. I don't know if Power Query would be doing that as well.

    The bottom line is, as far as I know, if any other app uses messaging, and we load at Excel start up, we appear to be breaking their app, and I have no idea what we could be doing to cause this.

    Thanks,

    Huck

    Tuesday, May 10, 2016 5:10 PM
  • Hi Huck,

    >> As I mentioned in the original post, I have yanked out all of the code and references to System.Runtime.Remoting.Messaging, and the problem persists

    Do you mean this problem persists if you comment out the code related with Messaging? If so, I think it might be related with other code in your project. Do you have any code in your ThisAddIn_Startup? If you create a new project with similar code in your original project, and run this two add ins, will they work correctly? It would be helpful if you could share us a simple code to reproduce your issue.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, May 11, 2016 6:06 AM
  • Edward,

    Yes, I have commented out all the code related to Messaging.  As you say, it is clearly related to other code in my project.  I just have no idea what that is.  I can't post any simple code to recreate the issue, because I have absolutely no idea what code is causing the problem.  I do not have access to their code, so I can't post that, that is the code that is breaking.  That is why I am posting here - I am trying to find out what code in my add-in could possibly interfere with messaging in their add-in, because it doesn't appear to be my messaging code.  I have a few hundred thousand lines of code in my project, with no clue as to what is causing the problem.

    At your suggestion I created another app that duplicated my add-in, and the two cloned add-ins peacefully coexisted.  So what code in my project could possibly be breaking messaging (which I have been told uses IMessageFilter as described above) in their project?

    Thanks,

    Huck

    • Edited by Huckleberry32 Wednesday, May 11, 2016 9:00 PM used real name
    Wednesday, May 11, 2016 8:59 PM
  • Hi Huck,

    To be honesty, with so less information, I am not able to find the cause. What I could suggest is commenting code part by part to check which part code cause this issue. Otherwise, I am afraid you need to connect PowerQuery developer to narrow down this issue, they are more familiar with PowerQuery.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, May 12, 2016 1:56 AM
  • Edward,

    How can I get in touch with a PowerQuery developer?

    Thanks,

    Huck

    Thursday, May 12, 2016 3:54 PM
  • Nevermind. I believe the PowerQuery issue is a red herring. I am going to contact Microsoft Priority Support.
    Thursday, May 12, 2016 8:50 PM
  • Hi Huck,

    Sorry for less help. If you have any updates about this issue, it would be appreciated if you could share us.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, May 13, 2016 2:52 AM
  • Hi Huck,

    The COM message filter as described in the post you link to does not work quite as expected with Excel. Internally Excel has some additional synchronization (I think they call it suspension) of the COM calls, and this mechanism does not respect the COM message filter approach.

    The best guideline is to be very careful about when you are making COM calls to Excel, among other rules you should never call Excel from a thread that is not the main thread. Even on the main thread you might be in a context where COM calls will fail.

    Your use of remoting messages is (mostly) a completely separate concept to the IMessageFilter which relates to internal COM messages.

    Perhaps your problems relate to how the remoting configuration is initialized, which is why the load sequence seems to matter.

    -Govert

    Excel-DNA - Free and easy .NET for Excel

    Friday, June 10, 2016 8:59 PM