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
 More strange syntax coloring in C#
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
1929 Posts

Posted - Nov 21 2019 :  06:28:08 AM  Show Profile  Reply with Quote
A few things seem off in this screenshot:
1) the m_stationmode variable (which is an enum)
2) according to the settings, vars should be gray but are mostly white
3) the enum StationMode color at definition does not match the color at use




feline
Whole Tomato Software

United Kingdom
16777 Posts

Posted - Nov 21 2019 :  2:17:53 PM  Show Profile  Reply with Quote
Point 1, I would say that "m_stationmode" is a variable. The variable type is enum, but the actual symbol its self is a variable, so I would expect it to be coloured as a variable. Does this thinking make sense?

Point 3, as far as I can tell "StationMode" where the enum is declared, and the items are collapsed, is being coloured by the IDE, not by VA. In C# VA is not applying its enum colouring to the enum declaration. I have put in a bug report for this:

case=141540

I have had a look at the IDE font and color settings, but I am not sure which setting is being used here. If you set it to the same colour as VA is using for classes, structs, enums, etc, then the colouring problem should go away.

Point 2, I am not sure what is going on here. Just looking at the top of your screen shot, you have 5 variables being declared across 5 lines, but they are in two different colours.

If you make variables using simple, built in types, do you still get this problem? I am wondering if the type of the variable could be a factor. I don't see why it should be though.

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

Uniwares
Tomato Guru

Portugal
1929 Posts

Posted - Nov 21 2019 :  3:04:09 PM  Show Profile  Reply with Quote
1) yes, its a variable. But, its not consistently colored. The only line where the coloring is correct is the declaration.
The collapsed enum declaration is actually always correct, collapsed or not.
I tried using builtin types for vars but see the same effect. Rarely vars are colored correctly and consistently. (havent we been through that like 12 years ago?)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16777 Posts

Posted - Nov 22 2019 :  11:36:02 AM  Show Profile  Reply with Quote
Is there any chance of getting a copy of your solution to test here? I appreciate this is probably not possible, but it's worth asking on the off chance.

For the enum, I went through and changed all of VA's colours to very bright and distracting colours, and when doing this, the colour I have told VA to use for enum's is not used where the enum is declared, but it is used when the enum is referenced. Collapsing and expanding the enum definition made no difference here for me. So if your enum colour is correct some of the time and wrong at other times it looks like you are seeing a different problem to the one I have found.

I have created a new, default C# Windows Forms application, using VS2017 and VA 2353.0, and I am slowly adding some basic code to this solution. This way I know I have a simple test case that compiles and runs, even if it doesn't do anything useful. I can also send you this solution, so we are both looking at the same code, and hopefully seeing similar behaviour from VA.

Currently my form starts with the code:

enum SNIPPET_FLAVOUR
{
    CHOCOLATE, ORANGE, MINT, STRAWBERRY
}

readonly String MainWindowTitle = "This is a test string variable";
private long m_SnippetNumber = 0;
private String m_SnippetName = "Snippet_";
private String m_SnippetBody = "The body goes here, it really should vary a bit";
private DateTime m_DateSnippetAdded;
private SNIPPET_FLAVOUR m_CurrentFlavour = SNIPPET_FLAVOUR.CHOCOLATE;

and all of these variables are coloured as variables for me.

Based on your experience, would you expect me to see a problem with this?




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

Uniwares
Tomato Guru

Portugal
1929 Posts

Posted - Nov 22 2019 :  11:42:39 AM  Show Profile  Reply with Quote
Oh, btw, I am using VS2019.
Actually I can send you the project, its just a UI dummy for now. Give me an email address to send it to, or any other drop target.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16777 Posts

Posted - Nov 23 2019 :  07:05:12 AM  Show Profile  Reply with Quote
This sounds very helpful, can you please send the project to:

support@wholetomato.com

including this thread URL so we can easily match it up. If you can also include your IDE and VA settings, this would be helpful. I can then make sure I am testing with your colour scheme, in case that is a factor.

VA Options -> Performance -> Export Settings
IDE tools menu -> Import and Export Settings -> Export selected environment settings

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

Uniwares
Tomato Guru

Portugal
1929 Posts

Posted - Nov 25 2019 :  09:41:34 AM  Show Profile  Reply with Quote
sent
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16777 Posts

Posted - Nov 26 2019 :  2:16:19 PM  Show Profile  Reply with Quote
I have the files, having a look now. Thank you for these.

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

feline
Whole Tomato Software

United Kingdom
16777 Posts

Posted - Nov 26 2019 :  3:27:06 PM  Show Profile  Reply with Quote
On first opening your solution, and opening the "MainForm.cs" file, which is the one you have posted the picture of, using my default IDE and VA settings, all of the variables are the same, and correct colour. However, I was informed on opening the solution that I needed to either install .NET 4.8 or change the targetted version of .NET for the solution.

I have tested both approaches, and I have imported both your IDE and VA settings, and restarted VS2019 several times. I have even done a VA symbol database rebuild. So far the only thing I am seeing obviously is that the namespace shows up in two different colours, which I have already reproduced and put in a bug report for.

Is there anything obviously "odd" or unusual about your system that might be a factor?

So far the only clues I have is that I am not connected to your source control, which really should not matter at all, and when importing your IDE settings I get errors that several SQL commands don't exist for keyboard bindings:

SQL.ExpandWildcards
SQL.MovetoSchema

are these due to another extension you have installed?

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

Uniwares
Tomato Guru

Portugal
1929 Posts

Posted - Nov 26 2019 :  3:36:28 PM  Show Profile  Reply with Quote
I certainly don't think that anything is different on my system, its a virgin notebook, with pretty much nothing installed besides windows and MS dev tools.
As for the SQL commands mentioned, no idea at all. No extension for data or sql installed.
Color scheme in VS is dark, windows is default scheme too. Source control definitely should not make a difference.
But my experience here is constant. I will try some other projects in c#, lets see.
Go to Top of Page

Uniwares
Tomato Guru

Portugal
1929 Posts

Posted - Nov 27 2019 :  03:48:03 AM  Show Profile  Reply with Quote
I have done some more testing here and from what I can see the problem stems from the fact that the settings in VS2019 -> Tools -> Options -> Environment -> Fonts and Colors -> VA* are set to "automatic", this doesnt seem to map to all the colors set in the VA options.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16777 Posts

Posted - Nov 27 2019 :  06:59:29 AM  Show Profile  Reply with Quote
Is this most of the VA colours? On the system here, where I have imported both your IDE and VA settings, scrolling through the IDE Font and Colors list, all foreground and background colours are set to "Default" except for the following:

VA Class - foreground and background = Custom
VA Find Reference - foreground = Automatic, background = Custom
VA Find Reference (Modified) - foreground = Automatic, background = Custom
VA Variable - foreground = Automatic, background = Custom

I would expect to end up with the same settings as you after importing your settings here.

I am wondering if the order of settings being imported is somehow a factor here, so I have reset my test machine, and just imported your VA registry settings. Now every VA colour in the IDE font and color options list is set to "Default" for both foreground and background.

Now importing your IDE settings after importing the VA settings, I am back to the same mixture of Default, Automatic and Custom as above. So at least this result is consistent.

Does setting the VA colours to Default in the IDE options dialog actually help?

As for the SQL missing keymappings, I am guessing you have installed an IDE component I haven't installed here.

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

Uniwares
Tomato Guru

Portugal
1929 Posts

Posted - Nov 27 2019 :  07:07:09 AM  Show Profile  Reply with Quote
Changed all to default (or custom) already and it seems to work correctly now. My guess is that something in the settings system of VS2019 is not exactly working 100%. The fact that some of the VA dialogs about VS/VA duplicate functionality are coming up at unexpected times, seem to confirm that.

Remembering now, I had done a full install of VS2019 at first, later uninstalled all the Azure/Data Lake stuff. Might be from there as this is updated frequently still.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16777 Posts

Posted - Nov 27 2019 :  10:55:27 AM  Show Profile  Reply with Quote
This probably explains some of the strange problems you have been seeing. I have seen occasional cases where the IDE profile ends up in a messy state, and this can cause problems for VA and how we work in the IDE. Hopefully now the colours have all been set manually they will start working problem, and I can easily reproduce any issues you encounter.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000