Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VA 2385: whoa, rename references messed me up

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

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

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
Uniwares Posted - Aug 20 2020 : 11:40:06 AM
Ok, now that was unexpected: I had a little class called Test in my C# .Net Core project. Played around a bit and then changed its name to something else, selected "rename references" and then ALL occurances of "Test" in all projected where renamed. Namespaces, Texts, etc. not only references (of which I had only 4)
Since I have 2 unit test projects in the solution, all of the 300+ files have a namespace like "project.x.x.Test" you can now imagine how happy I was.
Whats happening with VA + .Net Core projects?
10   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Aug 29 2020 : 08:56:09 AM
My first simple examples didn't have quite the right pattern, and when I tried setting up the "obvious" test I was doing it in the same project, so I started with the right answer, but the wrong details, so concluded there had to be something else going on I didn't know. Seems obvious now *sigh*
Uniwares Posted - Aug 28 2020 : 2:09:12 PM
You'd make a good private investigator.
feline Posted - Aug 28 2020 : 1:58:31 PM
Finally got to the bottom of this problem:


Basically if you place them in different projects C# lets the namespace contain both a class and a namespace with the same name, but if you put them in the same file then it is invalid, since it is a duplicate name. So obviously something must be happening to scope this, to avoid the conflict.

For now, to stop VA getting confused like this, you can tell Find References not to search across projects. Not ideal, but it does avoid this problem.
Uniwares Posted - Aug 27 2020 : 11:34:58 AM
All right, makes some sense now. Lets work on the "separate question" then.
feline Posted - Aug 27 2020 : 11:26:37 AM
The "Highlight all" checkbox in the Find References Results should toggle highlighting On and Off in the editor windows, not in the Find References Results window its self.

The highlighting in the Find References Results window is for the results that VA has picked up, so it makes sense that these unexpected results are being highlighted, since VA has decided that they are suitable results. Why that is is a separate question

Does this make sense and explain the highlighting you are seeing? Or is there another issue at work here as well? It wouldn't surprise me.
Uniwares Posted - Aug 27 2020 : 10:44:01 AM
Actually all references in the image above highlighted are namespaces or classes and they are always highlighted, independent of the setting.
But I am happy you can see the problem too. So I do not need to manage my drinking habits
feline Posted - Aug 27 2020 : 10:37:29 AM
I have managed to reproduce this in both VA 2385.6 and 2382.0, but only sometimes. There is more to this than just a duplicate symbol name, but I am not yet sure what the trigger is.

As for highlight all, highlight all is only supposed to highlight references in code, either in the editor window or the results window. It isn't supposed to highlight references to the symbol in the file name or path. Am I missing something, or are all of the non highlighted references in your screen shot path references?
Uniwares Posted - Aug 21 2020 : 09:33:19 AM
The in-editor menu doesnt come up always (my guess is that there is a fight for who gets to show a context menu, just as there is for the icon position when hovering over a symbol), but when it comes up and its used, there is no preview, only execution (literally). The rename dialog gives me the preview as expected.

I am running here 2385.6 (testing for the lockup with elevated privileges)

The Find References is reproducible.

(seems the "highlight all" isnt working anymore either)

feline Posted - Aug 21 2020 : 09:15:33 AM
The rename, was this done via the Rename dialog, so you had a preview of what was happening, or after an edit in the code without the preview dialog. You have reported a problem with an edit in the code, no preview dialog, showing a problem here:


which I am still struggling to reproduce here, even using VA 2385.0

For the Find References, is this reproducible? Again, so far, I cannot reproduce most of these problems. I have set up a simple .NET Core console test solution here.

If Find References is set to search for and display comment and string references then yes, it is expected to return "Test" as a reference, since this is a string, and there is no obvious way to tell that this isn't a reference you want.

However the namespace references are not being picked up for me.

I am testing with VA 2385.0, is this the same version as you? If you are using a non public version the last part of the version number also tends to matter.
Uniwares Posted - Aug 20 2020 : 11:44:14 AM
Just saw: Find References also shows all namespaces ending in ".Test" and all strings "Test" as references to the class Test

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