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:

EXCEL_7gK5ojzvFk

Steps to reproduce:

  1. Follow the “Getting started” guide in https://excel-dna.net/
  2. Add an ExcelArgument attribute to name parameter of SayHello method, e.g.: [ExcelArgument(Name = "Name", Description = "Enter your name")]
  3. Build and run the addin
  4. Load ExcelDna.IntelliSense[64].xll
  5. Focus on a cell and press Windows key and plus sign - Magnifier appears
  6. Close Magnifier (optional)
  7. 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: image

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

Most upvoted comments

@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_LOCATIONCHANGE was 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: image

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 Focus and Hide as the event pair. If you update the PR here I’m happy to merge in for the next version.

@sshukurov You said:

What I don’t actually understand is why the need for Show and Hide handlers if they are currently effectively a noop? Was that intentional or were they added with a look to the future?

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.