Author |
Topic ![Next Topic Next Topic](icon_go_right.png) |
|
mvolkar
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
20 Posts |
Posted - Mar 20 2024 : 08:27:00 AM
|
We recently upgraded from using Visual Studio 2019 to 2022 and at the same time started using the latest version of Visual Assist (I am currently using version 10.9.2511). Unfortunately, we have noticed situations where the Find References feature is not returning all references, and have started to lose faith in the tool. This is not a problem that we had in the older versions.
I don't think it is realistic to try to come up with a simple reproducible case, and our code base is somewhat complex, so I'm hoping that someone can suggest some troubleshooting steps. In the particular situation I ran into this morning, the Visual Studio Find All References feature seemed to return all of the results I would expect to see.
Any help you can provide would be appreciated. |
|
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
18915 Posts |
Posted - Mar 20 2024 : 10:54:16 AM
|
Can you please try right clicking in the Find References Results list, and turn On:
Display unknown/guess hits (G)
what effect, if any, does this have on the problem?
If you find one of the missing results, can you trigger Find References on this missing result? If not, that will tell us that our parser isn't properly understanding the code. If we can find specific examples where our parser is confused, hopefully we can study them and work out what is going wrong, especially if this is a regression in VA. |
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) |
|
mvolkar
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
20 Posts |
Posted - Mar 20 2024 : 11:44:30 AM
|
The reproducible case I had earlier this morning is no longer reproducible, but I found another instance. Anecdotally, the problem seems to occur most often with members of structs or unions, but I can't say it's never happened in other situations.
In this case, I am trying to find a field in a struct. Starting from the definition, Find Reference returns only one result, which is the in the struct definition. When I right-click the results, I don't even have an option to "Display unknown/guess hits". I have attached a screenshot:
![](https://forums.wholetomato.com/forum/uploaded/mvolkar/202432011395_Screenshot 2024-03-20 113540.jpg)
When I navigate to one of the missing references (found via Find in Files) and perform a Find References, more results are shown. Unfortunately, in this case we have a class data member with the same name as the field in the struct (also used in the same class) and so both results are being shown. This is different than the missing references, but equally wrong, because these are two different things. |
![Go to Top of Page Go to Top of Page](icon_go_up.png) |
|
shippy
Senior Member
![](icon_star_green.gif) ![](icon_star_green.gif) ![](icon_star_green.gif)
USA
30 Posts |
Posted - Mar 20 2024 : 1:30:00 PM
|
I'm hitting this same issue. If I use VA's Find References (Ctrl+Alt+F) on a method, then it is finding the .h declaration and .cpp implementation, but not uses of the method. It's not true for every case, but it was enough to get me to start noticing something was off and hit up the forums. If I use VS's version of Find All References (Shift+F12) it finds it all just fine. I do not see any "Display unknown/guess hits" option for VA find references, either.
VA_X64.dll file version 10.9.2511.0 built 2024.01.23 DevEnv.exe version 17.9.34701.34 Enterprise msenv.dll version 17.0.34701.34
|
-Shippy |
Edited by - shippy on Mar 20 2024 1:32:08 PM |
![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
18915 Posts |
Posted - Mar 21 2024 : 08:14:25 AM
|
Can both of you please find a place or two where the symbol is being used, but not found, and then place the keyboard caret into the symbol. What, if anything, is shown in VA's context and definition fields? These are normally shown at the top of the editor window, and are where the Alt-M list appears from.
My first guess is that the context and definition fields will be blank, which happens when our parser doesn't understand the code well enough to display anything there. But if that was the case, I would expect there to be unknown/guess hits coming up, so VA might be displaying the wrong information there.
What, if anything, does Alt-G do on this not found symbol instance?
What, if anything, does triggering Find References on this not found symbol instance do?
Basically we need to find and study some examples to get some idea of what is going wrong here. Clearly its a bug, possibly even a regression, but I need to be able to reproduce something here ideally to try and help fix the problem, or at least get a bug report in.
If I can prove its a regression, and find out when it broke, that will help, and also make this a more urgent bug report. |
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) |
|
mvolkar
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
20 Posts |
Posted - Mar 21 2024 : 12:49:58 PM
|
Using the same field of the same struct as my screenshot from yesterday, I looked at the Context/Definition bar at the top of the editor window. Interestingly, it shows the wrong thing (the class data member of the same name):
![](https://forums.wholetomato.com/forum/uploaded/mvolkar/2024321123933_Screenshot 2024-03-21 123827.png)
If I do an Alt-G, it then (logically) takes me to the wrong definition.
At some point yesterday, I had considered if this might simply be another instance of the bug I reported in https://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=14008 back in 2017, but the struct in question is using the "tag workaround" you had proposed there.
For the sake of this investigation, if I rename the symbol to something that doesn't have the same name, then Find References seems to work as expected. Interestingly, even in this case (i.e., with the renamed symbol), the Context and Definition bars are blank as you guessed, so maybe that is still a clue.
I will say, however, that I don't think every instance of missing results that I've seen has been due to conflicting names. I'll try to find a different/better example, but I've also see the results be inconsistent. |
![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
18915 Posts |
Posted - Mar 21 2024 : 1:15:37 PM
|
Starting from this point, where the "cogGain" is getting the wrong context and definition information, what about the symbol before the dot?
To try and explain what I am getting at, consider the following, deliberately INVALID code:
struct CorrectContainer
{
int cosGain;
};
struct WrongContainer
{
int cosGain;
};
void TestingFindRefOnCosGain(void *pUnknownType)
{
pUnknownType->cosGain;
} Place the caret into the last "cosGain" in this code snippet, and the context and definition fields are blank. But place them into "pUnknownType" and they have a value.
In your code, does VA have the correct type for the symbol before the dot? Or is that also wrong? I am guessing that somehow VA has the wrong type for "pUnknownType", but thinks that the wrong type is a type that happens to contain a "cosGain" member, which is why this "cosGain" isn't showing up as an unknown reference. |
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) |
|
mvolkar
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
20 Posts |
Posted - Mar 21 2024 : 1:27:20 PM
|
I think you may be on to something here. Continuing with the renamed field just to eliminate the duplication for a moment, here is the situation I have in the class definition (code simplified for the sake of brevity):
typedef struct Registers_tag
{
...
uint32_t cosGainFoo;
...
} Registers_t;
Registers_t volatile *fpgaRegisters;
Then, the only usage of cosGainFoo looks like this: this->fpgaRegisters[encoderChannel].cosGainFoo
We're doing something that is perhaps a bit unorthodox here and indexing a pointer as if it was an array. Perhaps that is confusing Visual Assist's parsing here. When I click on fpgaRegisters, the Context/Definition does show my the correct thing, however:
![](https://forums.wholetomato.com/forum/uploaded/mvolkar/202432113255_Screenshot 2024-03-21 132448.png) |
![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
18915 Posts |
Posted - Mar 21 2024 : 1:58:12 PM
|
Simplifying this right down, probably far to far, I have this in a header file:
typedef struct Registers_tag
{
uint32_t cosGainFoo;
} Registers_t; and this in the matching cpp file:
void testingArrayAccessOnPointer()
{
Registers_t volatile *fpgaRegisters;
fpgaRegisters[0].cosGainFoo = 1;
} and everything is working just fine for me here. Which is reassuring, since while array access on a pointer is probably a "bad" thing if you are reckless, I suspect it is also done a lot, for plenty of good reasons. So if we simply don't handle that at all we are going to have a lot of problems.
If you copy the access line and place it at the top of the class member function, does that make any difference? I am trying to work out if the reasonable looking like using "cosGainFoo" is the problem, or if the problem is coming from something else that is going on here in the same function or file.
Does Alt-G take you to the correct location when used on "fpgaRegisters"?
Am I reading this right, that you are working with a 2 component template class? |
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) |
|
mvolkar
Junior Member
![](icon_star_green.gif) ![](icon_star_green.gif)
20 Posts |
Posted - Mar 21 2024 : 3:17:16 PM
|
Since this problem is happening on one fairly isolated C++ file, I'm going to see if I can reproduce it in a dummy project with basically only that file. If I can do so, is there a way I can send you this project, which will contain one small part of our code? Although it's probably not that interesting, I don't want to post it in a public forum. |
![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
18915 Posts |
Posted - Mar 22 2024 : 05:46:21 AM
|
Of course, if you have anything you feel it is acceptable to share ONLY with us, which will be used ONLY for debugging this problem, please send me the files via email:
[email protected]
including this thread ID or URL in the description, so we can match it up. The first thing I will do, after confirming I can reproduce the problem, will be to try and simplify the problem right down, so deleting as much of your code as possible, never to be seen again. |
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) |
|
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
18915 Posts |
Posted - Mar 22 2024 : 07:31:26 AM
|
I have the test files, many thanks for these:
case=164351
I have replied via email to avoid splitting the conversation into two places. |
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) |
|
mariahcarey
New Member
![](icon_star_green.gif)
USA
2 Posts |
Posted - Mar 31 2024 : 11:39:57 PM
|
quote: Originally posted by mvolkar
Using the same field of the same struct as my screenshot from yesterday, I looked at the Context/Definition bar at the top of the editor window. Interestingly, it shows the wrong thing (the class data member of the same name):
![](https://forums.wholetomato.com/forum/uploaded/mvolkar/2024321123933_Screenshot 2024-03-21 123827.png)
If I do an Alt-G, it then (logically) takes me to the wrong definition.
At some point yesterday, I had considered if this might simply be another instance of the bug I reported in https://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=14008 https://wordlewebsite.com back in 2017, but the struct in question is using the "tag workaround" you had proposed there.
For the sake of this investigation, if I rename the symbol to something that doesn't have the same name, then Find References seems to work as expected. Interestingly, even in this case (i.e., with the renamed symbol), the Context and Definition bars are blank as you guessed, so maybe that is still a clue.
I will say, however, that I don't think every instance of missing results that I've seen has been due to conflicting names. I'll try to find a different/better example, but I've also see the results be inconsistent.
Attempt to reproduce the issue with different code constructs or scenarios in your codebase. While it may not always be possible to create a simple reproducible case, identifying specific patterns or scenarios where Find References fails to return expected results can help narrow down the problem. |
![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
18915 Posts |
Posted - Apr 02 2024 : 08:54:18 AM
|
Do you use partial template specialization in your code? In the example where I have been able to reproduce the problem, the following code concept is being used:
template<bool T>
class templateShowingSpecializationSpecificMembers
{
private:
short m_nUnspecializedMember;
};
template<>
class templateShowingSpecializationSpecificMembers<true>
{
private:
short m_nTrueSpecializedMember;
public:
short GetTrueHeight() { return 12; }
short GetTrueDepth() { return 21; }
}; I had no idea you could have different class members for the same class, depending on the template specialization, but the code compiles quite happily. This seems to be a factor in the Find References problem, since sometimes VA is getting confused here. |
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) |
|
virtuousden
Starting Member
Tunisia
1 Posts |
Posted - Jun 13 2024 : 04:47:17 AM
|
quote: Originally posted by mariahcarey
quote: Originally posted by mvolkar
Using the same field of the same struct as my screenshot from yesterday, I looked at the Context/Definition bar at the top of the editor window. Interestingly, it shows the wrong thing (the class data member of the same name):
![](https://forums.wholetomato.com/forum/uploaded/mvolkar/2024321123933_Screenshot 2024-03-21 123827.png)
If I do an Alt-G, it then (logically) takes me to the wrong definition.
At some point yesterday, I had considered if this might simply be another instance of the bug I reported in https://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=14008 https://flappy-bird.co back in 2017, but the struct in question is using the "tag workaround" you had proposed there.
For the sake of this investigation, if I rename the symbol to something that doesn't have the same name, then Find References seems to work as expected. Interestingly, even in this case (i.e., with the renamed symbol), the Context and Definition bars are blank as you guessed, so maybe that is still a clue.
I will say, however, that I don't think every instance of missing results that I've seen has been due to conflicting names. I'll try to find a different/better example, but I've also see the results be inconsistent.
Attempt to reproduce the issue with different code constructs or scenarios in your codebase. While it may not always be possible to create a simple reproducible case, identifying specific patterns or scenarios where Find References fails to return expected results can help narrow down the problem.
How can you easily identify specific patterns or situations where Find References that do not return expected results can help narrow down the problem? |
![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
18915 Posts |
Posted - Jun 13 2024 : 09:52:55 AM
|
Can you find some examples in your code base where Find References always fails, and some where it works? If so, we can work from here. |
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) |
|
|
|