Author |
Topic ![Next Topic Next Topic](icon_go_right.png) |
|
OmegaNemesis28
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
USA
16 Posts |
Posted - Apr 16 2021 : 4:37:36 PM
|
VS 2019 with VSX build 2393 (VA_X 10.9.2393) Windows 10
I have a rather massive project and sometimes, if I try to do a Shift + Alt + F Find References, Visual Assist will break and just do a simple text search on the method name with no context to the definition. I am unsure what triggers this, but it happens most with the most generic method names.
For example, a standard class with a simple public void method called Init() will trigger an entire solution-wide search with results of every method called Init(). No relation to the class at all and this particular method.
I've attempted clearing temp files and rebuilding the db.
Also, a similar behavior (although I do not think related?) is if I do a find references on the constructor method. It will find all references to the class despite clicking the constructor explicitly. |
|
feline
Whole Tomato Software
![](icon_star_red.gif) ![](icon_star_red.gif) ![](icon_star_red.gif) ![](icon_star_red.gif) ![](icon_star_red.gif)
United Kingdom
18749 Posts |
Posted - Apr 19 2021 : 08:16:25 AM
|
Are the results you are getting actually coming up in the Find References Results window? I just want to double check that VA really is doing a Find References here.
For the constructor search, there is an element of by design at work here. To find the constructor references we need to find all class references, and then filter down to just the constructor references if you ask. When working with a find on a class, right click in the results window, and you will get several filter options. The one you are interested in here is:
Display creation/construction hits (C)
so if you keep this turned On you can turn off other filters, to leave just these results.
For Find References on a function like "Init()", when this happens, if you cancel the Find References, and then run Find References again, do you see the same problem, or is this a random problem?
Assuming this can be reproduced, it sounds like VA is unable to determine the scope / context of the "Init()" function. Is this a class member function? A free function? A macro?
If you place the caret into the function name, what, if anything, does VA show in its context and definition fields? I am trying to work out how well VA understands the scope of this function call. |
zen is the art of being at one with the two'ness |
![Go to Top of Page Go to Top of Page](icon_go_up.png) |
|
OmegaNemesis28
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
USA
16 Posts |
Posted - Apr 20 2021 : 8:44:53 PM
|
Yes this is the VA Find References window.
I think the key to both issues I believe is the right click menu. -Like you said, toggling only for that gives me constructors. -For the text search results: There's a "unknown/guess" filter. Disabling this filter gives me the results I'm looking for. The thousands of values I was getting go away now making it far more useful.
Shame there isn't a faster way to filter like toggle all or buttons I can click. But the key shortcuts arent too bad. |
![Go to Top of Page Go to Top of Page](icon_go_up.png) |
|
OmegaNemesis28
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
USA
16 Posts |
Posted - Apr 21 2021 : 02:16:03 AM
|
There are some valid results that get removed if I disable the "unknown/guess" filter though. I just noticed they're marked with ? icon next to them in the VA Find References pane. I figured out a reproduce. Looks like VA is struggling with templates.
Code below is obviously flawed, dont run it please :P The only one VA recognizes is the first Init call in main() that has 1 level of template. FindReferences on it gives ? unknowns/guesses for the others.
The others after that I cannot shift right click to get the context menu from VA directly on their Init. If I try the shortkeys for VA Find References on these, I get an error popup "Find References is not available symbol not recognized"
struct Value { void Init() { } };
template <class T>
struct Container { T* value; };
typedef Container<Value> SingleContainerWorks;
typedef Container<Container<Value>> DoubleContainerFails;
typedef Container<SingleContainerWorks> NestedTypeDefFails;
int main()
{
SingleContainerWorks* root = new SingleContainerWorks();
root->value->Init(); // VA only recognizes this.
DoubleContainerFails* rootD = new DoubleContainerFails();
rootD->value->value->Init();
Container<Container<Value>>* doubleContainerInLine = new Container<Container<Value>>();
doubleContainerInLine->value->value->Init();
NestedTypeDefFails* rootN = new NestedTypeDefFails();
rootN->value->value->Init();
}
|
![Go to Top of Page Go to Top of Page](icon_go_up.png) |
|
feline
Whole Tomato Software
![](icon_star_red.gif) ![](icon_star_red.gif) ![](icon_star_red.gif) ![](icon_star_red.gif) ![](icon_star_red.gif)
United Kingdom
18749 Posts |
Posted - Apr 21 2021 : 11:12:01 AM
|
Thank you for the very clear code sample. Looking at the code, I would not expect VA to have any problems, but I get exactly the same behaviour here. I have tried a couple of different approaches to work around this, but so far without success.
It looks like having a template container holding its self is somehow confusing our parser:
case=144640
because VA is getting confused, it cannot determine the proper scope of the Init function calls, so they are getting listed as guess hits, with the question mark icon, in the Find References Results list. As you have found you can filter out these results from the list, but since VA is confused by valid code, unfortunately filtering them out will filter out some valid results. |
zen is the art of being at one with the two'ness |
![Go to Top of Page Go to Top of Page](icon_go_up.png) |
|
|
Topic ![Next Topic Next Topic](icon_go_right.png) |
|
|
|