Author |
Topic  |
|
gbozoki
Ketchup Master
   
USA
70 Posts |
Posted - Feb 01 2013 : 10:57:03 PM
|
I've never used this functionality before but now I'm trying to enable the Automatically highlight references to symbol under cursor option in the VAX settings dialog. No matter what I do, however, I never get any highlighted symbols. I tried hovering with the mouse and moving the caret to various symbols: local and member variables, class names, etc.
I tried turning on the Highlight references using checkbox. I also tried clearing all VAX caches and databases (I manually deleted the cache folders under my profile folder as well) and I restarted the VS IDE several times but still no highlighting. The color selection for both colors is Lime.
When I try to use Find References and the Highlight all checkbox is checked, I do see the highlighting.
Is there anything else that I need to do to make this feature working (registry setting / option )?
The project is a C# project in a mixed C# / C++ solution in VS 2008. System info:
VA_X.dll file version 10.7.1925.0 built 2012.12.14 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; |
Edited by - gbozoki on Feb 01 2013 10:59:21 PM |
|
gbozoki
Ketchup Master
   
USA
70 Posts |
Posted - Feb 02 2013 : 5:12:17 PM
|
This feature just started working out of the blue - after having the setting on for 8+ hours (while I was actively working in VS on the same solution. I did restart the IDE a few times (unrelated reason) but it didn't seem to matter since I got no highlighting anywhere anyway.)
It doesn't work consistently, though - it provides highlighting in about 60% of the classes. In the remaining 40% it mostly doesn't work at all but I found a few classes where highlighting shows up in some functions but not all.
I cannot see any kind of pattern when it works and when it doesn't. The classes are all C# classes - some are static, some aren't. Some files contain multiple class definitions but I see highlighting randomly in some and not in others. I tried local and member symbols, etc.
For example, I have this function (snippet) in a class:
...
public override void LoadSomeXmlData ( XmlNode oMainNode )
{
if ( Enabled )
{
XmlNode oNode = oMainNode.SelectNode ( "...", false );
...
XmlNode oNode2 = oNode.SelectNode ( "...", false );
...
}
}
...
In this particular function most symbols highlight now as expected, except if I try to highlight SelectNode, it's never highlighted. (SelectNode() is an extension function for XmlNode. In this same class but in different member functions other XmlNode extension functions are highlighted.) I see this same behavior in at least 10 different classes.
There are files / classes where nothing is highlighted, even though none of these classes seem to be special in any way. |
Edited by - gbozoki on Feb 02 2013 5:31:39 PM |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19188 Posts |
Posted - Feb 04 2013 : 9:41:18 PM
|
Are you working in relatively large code files? Do you use code outlining? I am wondering if a lot of code outlining / folding going on could be a factor here.
In your example above, where "SelectNode" is not highlighted, what happens if you run Find References on this symbol?
If VA was confused by your code then this might explain some of your problems with highlighting the symbol under the caret, but if this was causing this many problems you should be having problems with Find References and other VA commands as well. |
zen is the art of being at one with the two'ness |
 |
|
gbozoki
Ketchup Master
   
USA
70 Posts |
Posted - Feb 05 2013 : 11:19:45 AM
|
Feline,
Yes, I use a lot of #region-s in the code; most source files have at least 10-15 regions but some have them in the low hundreds. (I have VAX macros that generate debugging / logging code in functions that are wrapped in regions so they're out of the way. Most functions have at least one of these blocks, so a source file will have several.)
When I try Find References on the SelectNode symbol, I get an error from VAX saying the symbol is not recognized. In that same source file, though, there's no highlighing for anything and Find References works for everything else I tried so far. Not even local variables are highlighted in trivial functions without regions.
This particular file is big (~3100 lines) but this is rare - most files I have the problem with are around 200-600 lines of code.
Hmm, you may be onto something. I just tried Outlining->Stop Outlining in 2 files that were giving me problems and when all regions are unfolded, reference highlighting starts working. So it looks like closed regions cause this in some files. (The issue of not finding SelectNode through Find References remains.) |
Edited by - gbozoki on Feb 05 2013 11:21:20 AM |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19188 Posts |
Posted - Feb 05 2013 : 1:13:11 PM
|
There is a known problem with a lot of folded code using outlining and VA having problems highlighting the current symbol under the caret:
case=29360
This is a slightly tricky problem, since you end up with two versions of the file, the visible version and the actual version.
Find References on the SelectNode symbol sounds like a separate problem. The error message tells us that our parser cannot make sense of this symbol for some reason.
If you show VA View, then place keyboard focus back into the editor, and now hover the mouse over the variable "oMainNode" what does VA show in the bottom half of VA View?
If you place the caret into the function call "SelectNode" what does VA show in its Context and Definition fields? These are normally at the top of the editor. I am wondering how much of this code VA understands, and where the problem first shows up. |
zen is the art of being at one with the two'ness |
 |
|
gbozoki
Ketchup Master
   
USA
70 Posts |
Posted - Feb 05 2013 : 3:36:04 PM
|
Feline,
The method SelectNode() is defined roughly like this:
namespace SomeNamespace
{
internal static class XmlHelper
{
public static XmlNode SelectNode ( this XmlNode oNode, string sName, bool bAdd )
{
...
}
}
}
There are 2 overloads but when I put the caret inside either one, the VAX dropdowns (on top of the editor) correctly update - they show the namespace and the correct function declaration.
I never use the VAX view - what should I expect to see when I open that window? When it came up, it just had 2 dropdowns on top for files / symbols in the solution and the rest was empty. (The dropdowns have a lot of items but the VA View window doesn't show anything.) |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19188 Posts |
Posted - Feb 05 2013 : 5:08:36 PM
|
If you go to the file where this class is declared, show VA View, then place keyboard focus back into the editor, and now hover the mouse over the class or some of the other member functions do you get a tree control in the bottom section of VA View? You should, and this tree control should show the class and all of the members that VA knows about. There are a couple of screen shots of this in action here:
http://www.wholetomato.com/products/features/hcb.asp
The fact the functions are in the Alt-m list is interesting and helpful. Its possible the confusion is where you are using this class variable, rather than with the class declaration its self. This is where I am hoping VA View will shed some light on the class members VA thinks this class has. |
zen is the art of being at one with the two'ness |
 |
|
accord
Whole Tomato Software
    
United Kingdom
3287 Posts |
Posted - Feb 05 2013 : 5:41:41 PM
|
So if I understand correctly, if you use Find Reference on SelectNode's definition, it works. But if you use Find References on SelectNode in an other file (were it is used), VA will just drop an error message.
Can you please try: 1. Run Find References on SelectNode in more files where it is used. Does VA drop an error message on those places as well? 2. Run Find References on SelectNode where it is defined. Is VA able to find any place where the symbol is used? Or does VA find some usage while skips others? |
 |
|
gbozoki
Ketchup Master
   
USA
70 Posts |
Posted - Feb 06 2013 : 12:16:58 PM
|
Feline,
Thanks for the explanation - when I tried it, it seems the VA View works fine - if I go to the file that declares the class / static method and hover over, the tree view shows up in VA View and the information seems correct. I also noticed that when I started folding up some of the regins (closing them), the tree view suddenly disappeared (not right away, after folding up maybe 6-7 regions) and then it stopped working in this file.
Accord, You're correct. I tried Find References on this particular symbol - I get references if I try within the file that declares it but nowhere else. The usage of this static method is pretty simple:
void SomeMethod1 ( XmlNode oNode, ... )
{
...
SomeMethod2 ( oNode.SelectNode ( "NodeName", false ) );
}
When I try within the file that declares this method, I get references from other places, too - I'm unsure if all references are found or not, since it's used in several places. When I start Find References in a different file, I only get an error for the SelectNode symbol. |
 |
|
accord
Whole Tomato Software
    
United Kingdom
3287 Posts |
Posted - Feb 06 2013 : 7:03:27 PM
|
When you run Find References on the declaration, - Do you get the references with a question mark icon? All of them? Some of them? None of them? - Is the usage (where you cannot start Find References from) listed? Is it marked with a question mark icon?
I am wondering if VA has a problem with the usage locally or with the definition itself. In other words, whether the problem with the usage is dependent on the context or not. When VA marks an occurrence in the VA Find References list with a question mark icon, it means that VA isn't really sure if it is a valid reference or just a symbol from an unrelated class or namespace. |
 |
|
gbozoki
Ketchup Master
   
USA
70 Posts |
Posted - Feb 06 2013 : 9:47:54 PM
|
Accord,
All references in the result list are 'questionmark' references, except for the first 2, which stand for the 2 overload declarations in the source file. One of these overloads calls the other overload, but even that reference is marked with a questionmark.
This is a .NET 2.0 project but we have a workaround in place to allow for extension methods. The declaration is
using System;
namespace System.Runtime.CompilerServices
{
/// <summary>
///
/// </summary>
[AttributeUsage ( AttributeTargets.Method | AttributeTargets.Class |
AttributeTargets.Assembly )]
public sealed class ExtensionAttribute : Attribute
{
}
}
to enable the VS 2008 C# compiler to compile extension methods in 2.0 projects. I'm not sure if this has any relevance to the issue (it shouldn't, since a 3.5 project would use the same syntax which VAX would have to parse anyay).
I did check several other extension methods against other types (we have a lot of extension methods) - every reference found is marked with questionmarks for all of them. For common method names (like GetValue()), all kinds of unrelated references are also included. |
 |
|
accord
Whole Tomato Software
    
United Kingdom
3287 Posts |
Posted - Feb 07 2013 : 8:27:08 PM
|
quote: One of these overloads calls the other overload, but even that reference is marked with a questionmark.
Okay, this is a good place to start. Are you able to reproduce this problem if you create a clean new C# project of the same type and copy this 2 method into it? (including its class and namespace definition) You may need to copy some other definitions as well like XmlNode or any other inside the method, but you may not need any. Would be nice to be able to create a simplified project where the problem happens.
I don't think that the AttributeUsage play a role here.
If you are not able to repro, it is possible that a project or solution setting is the problem. In this case, can you please try to make a copy of the solution and delete the projects from it and to add the newly created test project to this empty solution? |
 |
|
gbozoki
Ketchup Master
   
USA
70 Posts |
Posted - Feb 13 2013 : 2:43:13 PM
|
Accord,
Thanks for your answer. I'm very busy right now so it may take a few days but I'll try to test this out. |
 |
|
|
Topic  |
|