Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 VA1912 Find Symbol missing a class definition
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AlfredS
Junior Member

24 Posts

Posted - Aug 16 2012 :  4:17:29 PM  Show Profile  Reply with Quote
I have in my solution the project with the production code and the project with the test code. In the test project are several different variations of CRecipeExecSys implemented. VA offer me they in the find symbol window. The original declaration in the production project is not offered. The previous version 1908 was showing me the types but jumps almost to the wrong declaration. The same class name in different projects and namespaces worry VA a little?




Exists any solution for this?
Best regards Alfred

gbozoki
Ketchup Master

USA
70 Posts

Posted - Aug 16 2012 :  4:51:39 PM  Show Profile  Reply with Quote
I have actually seen this problem many, many times before with many versions of VAX (at least versions through 10.6 & 10.7). In C# the Find References feature very frequently fails to find symbols even though they're clearly available. (I know the above example is C++). It got to the point where I stopped using this feature because Rename renamed the wrong symbols on several occasions and left symbols to be renamed with the original name. Unfortunately these all happened on huge projects (well over 500 source files) so I have no easy steps to reproduce this.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Aug 20 2012 :  11:55:43 AM  Show Profile  Reply with Quote
AlfredS, does turning off "Show only symbols defined in current solution" make any difference?

If you use the Open File in Solution dialog, Alt-Shift-O, is the header file that holds the missing CRecipeExecSys class listed?

gbozoki are you able to reproduce this problem with Find References on demand in your main solution? If so we might be able to start working out what is going wrong here, and why VA is having problems.

zen is the art of being at one with the two'ness
Go to Top of Page

gbozoki
Ketchup Master

USA
70 Posts

Posted - Aug 20 2012 :  3:52:45 PM  Show Profile  Reply with Quote
feline,

Thanks for the reply - no, unfortunately I've never been able to reproduce this at will. In fact, the reason I checked on this thread today because it happened again, although this time it was a variation of the problem: the Find References dialog showed symbols that are named the same as the one I was trying to check but were unrelated.

My project is big, several hundred source files; there are C++ and C# projects in the same solution. I've seen this problem come up in this same project using both "Find References" and "Refactor->Rename", where a search
  • only turns up some of the instances of the symbol (but misses several instances).

  • finds all instances of the symbol but the results show unrelated symbols with the same name (like several unrelated classes having a Resolve() function - when trying to replace Resolve() in one class, it gets replaced in all those other classes.)

    I've seen this happen where I tried to replace a protected symbol defined in a C# class and similarly named symbols in C++ source & header files were also replaced.


This happens rarely but as I said, I've seen both problems on multiple projects.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Aug 20 2012 :  4:39:09 PM  Show Profile  Reply with Quote
It makes sense that this effects both Rename and Find References, since Rename uses the Find References results as its start point. Next time you see this problem, if you run Find References on a separate, unrelated symbol, and then run Find References again on the problem symbol, do you still get bad results?

Find References should give reliable results, if there is a problem it should be consistent, at least until you make another code edit.

zen is the art of being at one with the two'ness
Go to Top of Page

AlfredS
Junior Member

24 Posts

Posted - Aug 22 2012 :  03:52:56 AM  Show Profile  Reply with Quote
Hi feline!

We are now under VS2012 an here the class is viewed and this with the same setting of the find symbol dlg. When I deactivate G?Show only symbols in the current solutionG? the correct list entry switch to a wrong base class. Switch between CRESValidaten and mockCRecipeExecSys.

Under VS2010, where I was reporting the behavior, the problem is now disappear and no one of the checkboxes inside the find symbol dlg change this.

The rules how are the entries filtered or viewed is for me completely worry.

Best regards
Alfred
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Aug 22 2012 :  11:28:09 PM  Show Profile  Reply with Quote
In VS2010, where this is now working, if you open the Find Symbol dialog and use the filter "CRecipeExecSys" is this actual class shown just once, or more than once? I am assuming you have "Only classes, structs & namespaces" turned On, as shown in your original screen shot.

What file is this class in?

In VS2012, with no code files open in the IDE, is this file shown in VA's Open File in Solution dialog?

In both IDE's, with this file open, if you show VA Outline, is the outline correct? Is it showing the "CRecipeExecSys" class, and its members?

Since you are seeing a different result in the different IDE's I am searching for any clues as to why this is happening.

zen is the art of being at one with the two'ness
Go to Top of Page

AlfredS
Junior Member

24 Posts

Posted - Aug 23 2012 :  04:48:40 AM  Show Profile  Reply with Quote
Hi feline!

The symbol CRecipeExecSys is showed only once, exact how was in my 1st posting.

The class CRecipeExecSys is defines twice, in different projects both in the solution.
1st in our production code. There is the class in the global namespace. H + cpp
2nd. In the project where are our tests for the production code. Here is the class in a header. Without namespace. Included is this header after inside a namespace (nsNoCoverage). The base class of this declaration is mockCRecipeExecSys. In this header is the declaration of mockCRecipeExecSys and CRecipeExcSys. This declaration of CRecipeEyecSys has no relation to the original one. Except that they have the same name. This is necessary to replace this class in our production code under test with a mock Instance of this class.

When I look at the posted find symbol dialog I recognized that mockCRecipeExecSys is also viewed without namespace. I guess this comes when the header alone is parsed. Analog to this CRecipeExecSys should be offered twice. One time for the declaration inside mockCRecipeExeSys.h and one time for the declaration in RecipeExecSys.h. Or not? Consider VA the filepath where a symbol is declared?

In VS2010 and VS2012 when I enter G?recipeexeG? all expected files are offered. They are: RecipeExecSys.cpp, RecipeExecSys.h, RecipeExecSys_inl.h, mockCRecipeExecSys.h.
The first three are the implementation and declaration of the class CRecipeExecSys in the project for the production code. They donG??t include mockCRecipeExecSys.h
The last is in the test project. The class who use CRecipeExecSys has a include statement inside his cpp, but under test this include is blocked by #if/#endif . We include mockCRecipeExecSys.h before the testee to can mock/replace the class CRecipeExecSys for the testee. mockCRecipeExecSys.h declares the same include blocker as RecipeExecSys.h and avoid with this the including of the production declaration. I think VA recognizing defined & !defined macros when its parsed a file?

VA Outline test: Caret inside the class declaration. The class and here members are viewed correctly in both IDEG??s.

The behavior is in both IDE the same! Today I was repeat the test from yesterday in the VS2010 and now the viewed definition for CRecipeExecSys switch also when I change the checkbox G?Show only symbols defined in current solutionG?. IG??m 100% sure yesterday donG??t was.

Best regards
Alfred
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Aug 30 2012 :  7:39:01 PM  Show Profile  Reply with Quote
Currently, multiple occurrences of a symbol in the same namespace shown only once in Find Symbol dialog:

case=54823

As I read and understand your problem, this covers your problem for the most part.

Some explanation that may help understand the problem better:
1. when VA sees 2 different classes with the same name (in the same namespace), it will remember the last seen (parsed) one
2. VA parses both active and inactive code, so, for example, you can work even with non included code or use Add Include on them, since VA parsed and recognized them

case=54823 means that we are considering improving this behavior. Also, because of the above, it doesn't really matter if your "include is blocked by #if/#endif", since VA parses all files in your project. In other words, VA parses all files that are shown in the Open File in Solution dialog (alt+shift+o), thus showing them in the Find Symbol dialog (alt+shift+s).

Hope this makes sense. This may cause random behaviors as well, since the last parsed file may change over time.

Why the symbol was not shown in the dialog is a mystery though. But it seems to be resolved now. Basically, it can happen if the file is not listed in the Open File in Solution dialog, so VA not parse it initially, but later it may parse it (e.g. when you open the file manually)

Edited by - accord on Aug 30 2012 7:44:39 PM
Go to Top of Page

AlfredS
Junior Member

24 Posts

Posted - Sep 17 2012 :  05:01:36 AM  Show Profile  Reply with Quote
Thank you for the explanation! Now for me it's clearer why the effect comes and goes.

What's for not clear is why VA treats 2 classes with the same name in different files as the same? They never can be the same and both should be offered

Best regards
Alfred
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 18 2012 :  4:17:56 PM  Show Profile  Reply with Quote
VA knows about both classes and the members of both are offered in member listboxes. Find Symbol is an exception, it cannot handle multiple instances, and we are considering improving this at some point, this is what case=54823 is all about. Unfortunately, this is a limitation of Find Symbol dialog.

Edited by - accord on Sep 18 2012 4:23:22 PM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000