IntelliSense: Arguments tooltip is lost when certain topmost window steals focus
Hi @govert,
Our team has been struggling with an unpleasant issue when at times the arguments tooltip doesn’t pop up when needed. We tracked it down and created a minimal repro:

Steps to reproduce:
- Follow the “Getting started” guide in https://excel-dna.net/
- Add an ExcelArgument attribute to
nameparameter ofSayHellomethod, e.g.:[ExcelArgument(Name = "Name", Description = "Enter your name")] - Build and run the addin
- Load ExcelDna.IntelliSense[64].xll
- Focus on a cell and press Windows key and plus sign - Magnifier appears
- Close Magnifier (optional)
- Type
=SayHello(
Expected: Arguments tooltip must show up. Actual: It does not show up, closing the Magnifier doesn’t help.
More investigation by our team:
We turned on diagnostic logging and saw that the problem roots in FormulaEditWatcher.cs. It appears that it normally expects events in the following order: Focus > Show > Unfocus > Hide. In our case however, we saw events in the produced log in Focus > Unfocus > Hide order.
We attempted to add some compensating code to IntelliSense and it helped:

If that works, I could submit a pull request. Otherwise, we would love to hear your advice on this matter.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 17 (13 by maintainers)
Commits related to this issue
- #124 Fix case when arguments tooltip is not displayed when a topmost window steals focus — committed to VelixoSolutions/IntelliSense by sshukurov 2 years ago
- #124 Prevent arguments tooltip from hiding when switching forth and back with ALT + TAB — committed to VelixoSolutions/IntelliSense by sshukurov 2 years ago
- Merge pull request #125 from VelixoSolutions/bugfix/124-arguments-tooltip-lost-when-topmost-window-steals-focus #124 Fix case when arguments tooltip is not displayed when a topmost window steals focu... — committed to Excel-DNA/IntelliSense by govert a year ago
- #124 Troubleshoot IntelliSense arguments tooltip not appearing issue by re-enabling LOCATIONCHANGE event but only when fired for the caret — committed to VelixoSolutions/IntelliSense by sshukurov a year ago
- Merge pull request #130 from VelixoSolutions/bugfix/124-arguments-tooltip-regression #124 Troubleshoot IntelliSense arguments tooltip not appearing issue … — committed to Excel-DNA/IntelliSense by govert a year ago
- Revert "#124 Troubleshoot IntelliSense arguments tooltip not appearing issue by re-enabling LOCATIONCHANGE event but only when fired for the caret" This reverts commit 62d18116604979858f63cc3f2f88c17... — committed to Excel-DNA/IntelliSense by govert a year ago
- #124 Allow processing LOCATIONCHANGE events — committed to VelixoSolutions/IntelliSense by sshukurov a year ago
- #124 Unhook from LOCATIONCHANGE upon MOVESIZESTART and hook again upon MOVESIZEEND — committed to VelixoSolutions/IntelliSense by sshukurov a year ago
- #124 Clean up — committed to VelixoSolutions/IntelliSense by sshukurov a year ago
- #124 Bump IntelliSenseServer version — committed to VelixoSolutions/IntelliSense by sshukurov a year ago
- #124 Move location change hook registration to WindowLocationWatcher — committed to VelixoSolutions/IntelliSense by sshukurov a year ago
- #124 Update comments — committed to VelixoSolutions/IntelliSense by sshukurov a year ago
@sshukurov Your changes should be in 1.7.0-RC6 and from what I can see it works well. Thank you very much for the contribution.
I suppose (to answer the question from @wh1t3cAt1k before) that the ideal solution is to filter the WinEvents stream in native code, and have some mechanism to forward only the important information to the managed code. But the price of adding a native component to the IntelliSense library would be high - for example it would not be compatible with the Excel-DNA packing. One can go down the rabbit hole of have a native component managed from a resource, or making an executable region in data. But it doesn’t seem like the right solution in this case.
I’m happy if we can get to a reliable plan that stays in the managed world, and I think the position-update-after-move behaviour is fine for this case.
@govert this issue had been fixed for us for a while, before it re-surfaced recently with exactly the same symptoms. Closer investigation revealed that the regression happened after the changes made per https://github.com/Excel-DNA/IntelliSense/issues/123.
Our team troubleshooted this and we came to understanding that
EVENT_OBJECT_LOCATIONCHANGEwas necessary for the arguments tooltip to work properly but the event was replaced in the issue mentioned above.We referred to the official docs for the event, where it is said to be triggered for caret and window objects:
That knowledge allowed us to assume we could re-enable the handling of it, only in the context of “caret” objects - to restore the proper behavior of the arguments tooltip, at the same time keeping the fix for https://github.com/Excel-DNA/IntelliSense/issues/123.
We already made the relevant changes in our fork and got approval from our QA team. I’m going to proceed with a pull request to this repo and shall wait for you further feedback.
cc @sbolofsson
@wh1t3cAt1k No, I have no particular concerns with using only
FocusandHideas the event pair. If you update the PR here I’m happy to merge in for the next version.@sshukurov You said:
I don’t recall the details, but I presume I added cases to allow logging of any event that might be useful, then tried to use the logging to figure out a good pair to do the tracking.
I have no insight about other Windows or Excel versions.