Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Find References and Refactr|Rename don't work

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
gbozoki Posted - Nov 16 2012 : 11:29:52 AM
I have a large project that includes C++ and C# projects in the solution file. (~15 projects total) The C++ projects are all native code.

This is not the first time I'm reporting this problem but with the 10.7.1918.0 version it became worse and the Find References and Refactor->Rename functions became problematic. Here's a link to a previous report of this issue: http://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=10527

When I try to use Find References, I frequently get incorrect results. For example:

  • 1: Find references of a private symbol in a C# class: result list shows the same symbol name from hundreds of other, unrelated files (even C++). I don't understand why VAX even searches these other files: a private symbol cannot possibly be referenced from outside the current class (which is not partial). Refactor->Rename most of the time correctly renames these symbols but sometimes (very rarely) unrelated symbols are also renamed.

  • 2: Find references of a public symbol defined in one C# class and used in many places: results sometime (rarely) show all correct references but most of the time, a lot of the references are not listed. Sometimes the missing references are in the same file where other references were already found.


#2 is what triggered writing this post - I have a C# symbol named G.State which is defined as follows:

public static class G
{
    ...
    public static ProcessingState State
    {
        get
        {
            ...
        }
    }
}


G.State is used all over the code, in hundreds of C# source files. (It's not used in C++ but our C++ code has a symbol named State but it's not related at all. When I used Find References, it showed me 32 results in 5 source files, one of which was that unrelated C++ symbol. The project was compiled just before I tried the Find References because I noticed VAX stops working completely when there are any errors in the code.

I already reported a similar case not very long ago when Refactor->Rename renamed a bunch of unrelated references and I had to revert a massive number of my changes from source control to control the damage.

I cannot provide a small repro (my project has about 1700 source files) but this is something that happens 3-4 times a day (obviously not always on the same scale). In many cases, both features work fine.

I'm actually getting ready to give up on VAX because I consider this feature one of the most important and it's becoming a liability. I know I can uncheck items in the Rename dialog but if I constantly have to check every single reference and manually make sure it won't get broken, I don't see why VAX is better than the stock Search & Replace.

-------------------------
System info:

VA_X.dll file version 10.7.1918.0 built 2012.10.26
Licensed to:
VA X: ... (1-user license) Support ends 2013.06.18
DevEnv.exe version 9.0.30729.1 Enterprise
msenv.dll version 9.0.30729.1
Font: Courier New 13(Pixels)
Comctl32.dll version 6.10.7601.17514
Windows 7 6.1 Build 7601 Service Pack 1
8 processors (x86-64;
WOW64)
Language info: 1252, 0x409

Platform: Win32
Stable Includes:
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\include;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;

Other Includes:

Stable Source Directories:
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfc;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfcm;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\atl;
C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\crt\\src;
7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 31 2013 : 1:52:47 PM
Unfortunately there are a few known bugs with Find References and Rename, where VA finds either to many or to few results. As you say, this is more serious with Rename than Find References. We try to fix these as we discover them, but some of them are quite hard to pin down and fix. Thankfully most of them require very specific situations to trigger, so don't come up to often.

It is good that you are not encountering this problem to often, and hopefully it will be fixed fairly soon. If you were running into this all of the time then trying to find some form of temporary work around would be helpful, but this would probably require a change to your code, so its not ideal.

At least with Rename, if you realise that something has gone wrong, you can use the IDE undo command to revert the changes. This only helps if you realise quickly, but it is something.
gbozoki Posted - Jan 31 2013 : 04:53:42 AM
Feline,

Thanks for the ticket. I think the problem is actually more serious than you think. I'm not much bothered with an extra item showing up in the result list if it's guaranteed to be correctly checked / unchecked - this means that a replace operation (or others) will correctly include / exclude the item in question.

The problem is that VAX sometimes actually thinks that these items are a match when they're not (or alternatively, trivial matches are not found) - so now subsequent operations work on incorrect (too many or too few) matches.

As I said, I can't reproduce it reliably but I've seen that happen more than once. I don't encounter the issue now as frequently as I did when I originally posted because I'm not doing the kind of sweeping code changes I did back then.
feline Posted - Jan 30 2013 : 8:39:43 PM
I am seeing the same effect here. Thank you for the clear description.

case=72085

As you say, there is no need to search other files in this case, so I am not quite sure what is going on here. Hopefully this is not happening to often, so it is not to much of a problem.
gbozoki Posted - Jan 28 2013 : 4:49:40 PM
Feline,

Sorry for not replying for a long time - I was very busy.

As for the VA Options -> Advanced -> Fonts and Colors -> Local symbols in Bold option, I have it unchecked. (Let me know if you want to have my settings exported.) I cannot say if this issue is more related to C# or C++ - I work with C# much more frequently these days but our project has several C++ projects in it so the files are always present. (Our C++ code rarely changes nowadays and some of it are actually 3rd-party libraries.)

I only ever use the main (non-beta) releases of VAX and I typically update when a new version is out. I do miss an update every once in a while but that's rare. Since my original post I updated VAX to build 1925.

I just had a reproducible case of picking up incorrect symbols. Follow these steps:

1. Create new solution in VS 2008 with a C# project.
2. Download and add CryptoPP 5.6.1 to the solution. URL: http://www.cryptopp.com/#download
3. Add a new class to the C# project like:
// using directives

namespace SomeNamespace
{
    internal class MyClass<T>
    {
        private List<T> list = new List<T> ();

        public List<T> Items
        {
            get
            {
                return ( list );
            }
        }
    }
}


Now perform VAssistX->Find References on the list symbol. This will return 3 references (instead of the correct 2): 2 references in the C# file and a 3rd reference in channels.h from the CryptoPP project.

This is incorrect for several reasons:
  • list is a private symbol in a non-partial C# class. Why does VAX search in C++ source files in the first place?

  • std::list (which triggers the C++ match) is used in channels.h in a few other places. Those are not listed.


The C++ match has a questionmark icon next to it and in Rename dialogs it would show up but would be unchecked, so VAX realizes that this match is suspect. In the past, however, I've seen situations where such items were checked - I don't have a repro case for those and they seem to happen randomly. I also encountered cases where the number of incorrect matches is a lot higher but I can't find a symbol just now that reproduces this.
feline Posted - Nov 19 2012 : 10:56:48 PM
Do you work with:

VA Options -> Advanced -> Fonts and Colors -> Local symbols in Bold

turned On or Off? I was not expecting to see a problem with renaming a private variable in C#, since this should have been a simple case for VA to handle.

So I am wondering if you are ever seeing problems with local symbols in bold in either C# or C++, since this might offer us a clue.

Do you have time to try a couple of simple tests on your C# Win32.ERROR_SUCCESS? If so can you please try running a Find References on ERROR_SUCCESS in the .cs file where it is declared, and also in a different .cs file, where it is used but not declared. Does this have any effect on whether or not C++ references are being returned?

I am assuming you are using ERROR_SUCCESS outside of the file where it is defined, but it seems a fair assumption.

Is ERROR_SUCCESS in C# used in more than one project?

Do you know if you have been using all of the beta releases of VA? Just the main releases? I am wondering which version of VA you were using 2 or 3 versions ago where things seemed quite a bit better. Getting a sense of when things got worse is always helpful.

For the code errors causing VA problems, is this mainly a C# or C++ issue, or is it everywhere? Since VA is designed to help you while coding it is designed to be fairly robust in the face of invalid code. The main place I expect to see code problems causing problems is mismatched curly brackets, and even then this is normally limited to just the current function, or at worse just functions below the sight of the error.
gbozoki Posted - Nov 17 2012 : 9:54:57 PM
Feline,

Thank you for your reply. As for your first question, the private symbol was just a private static member variable in a C# class; something like:

namespace NamespaceA
{
    internal class ClassC
    {
        private static SomeType s_oVar;

        ...
    }
}


It's strange because as I wrote both Find References & Refactor->Rename work in many cases - usually in significantly more complex scenarios than this.

I forgot to mention that most classes in these projects are part of some namespace - we have quite a few namespaces and there are several duplicate class names across these namespaces but most classes are in a namespace. That old topic was the odd one. Very few classes are in the global namespace - I think that one may be the only one - class G is also in a namespace. We also have namespaces in some of the C++ projects (not all) and quite a few of our .cpp files contain only C code (just global functions).

Regarding the missing references: we have several symbols defined in C++ header files in the C++ projects and then we have symbols with the same names in our C# projects. The ones in C++ headers are not used or referenced from C# project.

For example, we have State in both C++ and C# projects but they refer to unrelated, incompatible states that are never interchanged. Another example is defines for Win32 symbols: there's ERROR_SUCCESS defined in winerror.h and it's also defined in one of our C# projects like this:

namespace NamespaceA
{
    internal static unsafe class Win32
    {
        ...
        public const int ERROR_SUCCESS = 0;
        ...
    }
}


If I did a Find References somewhere in the C# code on Win32.ERROR_SUCCESS I'd also see winerror.h listed in the result window sometimes - but not always.

The result window frequently shows unrelated symbols from C++ projects (when there's a duplicate name) - usually the .cpp files have a question mark icon next to them so VAX seems to realize that these references are somehow not right but they're still shown.

On the other hand, I did Rename on something like this (C#):

int nResult = oObj1.Obj2.GetSomeObject(a,"str").Property;


to rename Property to something else and it worked just fine.

Finally, about missing references: I think I see this problem frequently when I make sweeping code changes and try to rename symbols that are used in many places. Our code base is about 4 years old and there are some naming issues with some of the old code so every once in a while, we try to fix some of these as we go along. I see the missing reference problem quite a bit during these times but usually it works fine when a symbol is only used in a handful of places. Last week whwn I did several of these sweeping changes, I ran into this problem multiple times.

I cannot say for certain - only a gut feeling - but since I installed the current 1918 build, the problem seems to be noticably worse. As I commented in the first post, I noticed that I frequently have to make sure the code fully compiles to have several VAX features working - suggestions, completion, Find Refereces and Rename seem to break down in this build in some situations - not always.

I've noticed that in some cases if I have an unfinished statement in the code, VAX still works (as I expect). But sometimes if I'm typing a statement VAX just breaks down and doesn't offer suggestions, etc. until I complete the statement and make sure it's correct. This is something I noticed in the past 2-3 major builds of VAX and 1918 seems to be the worst by far. I'm sorry for not being more specific but I cannot reproduce these issues at will - they happen randomly but regularly.

I like VAX a lot (I'm a long-time user) but there's definitely something going on in the past few builds because I have several issues that I didn't encounter before.
feline Posted - Nov 17 2012 : 5:24:34 PM
Apologies for the problems you are seeing, we try hard to make both Find References and Rename reliable and accurate.

The first problem you mention, the private C# symbol, what sort of symbol was this? A member variable? A function? An enum? Something else?

Missing references and extra references are probably two separate problems, unfortunately, just to complicate things. From looking at the other thread you reference, are most of your C# classes inside namespaces, or are they in global scope? How about your C++ code?

Specifically is your C# "class G" inside a namespace?

Do you remember anything about the C++ reference VA found when you did the Find References on G.State? VA should know that "State" is a member of class G, so it should not simply match random symbols in totally different classes.

For missing references, this suggests a specific parser problem. Are you aware of missing references often, or just occasionally?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000