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
 VA 2399: weird navbar content
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2120 Posts

Posted - Mar 04 2021 :  12:24:38 PM  Show Profile  Reply with Quote
Am not sure what to make of the navbar and definition bar contents...


feline
Whole Tomato Software

United Kingdom
17242 Posts

Posted - Mar 05 2021 :  08:30:30 AM  Show Profile  Reply with Quote
How do I make sense of this? Clearly C# code, but is Part a class? A tuple? Something else?

This isn't the syntax for named parameters, as I first thought, and its not a normal constructor call, since that would be wrapped in round brackets.

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

Uniwares
Tomato Guru

Portugal
2120 Posts

Posted - Mar 05 2021 :  12:55:02 PM  Show Profile  Reply with Quote
Sorry, yes, its plain C#. The return new Part {} is the same as new Part() {}, since there are no parameters to the ctor, you can omit the brackets. Part is a class with a bunch of public properties, some mapped to a database through EF6.
Part should be present in a basic form in the solution you have from me.
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2120 Posts

Posted - Mar 05 2021 :  12:56:45 PM  Show Profile  Reply with Quote
The interesting thing about the weird definition bar content is that its not always the same even when the caret is on the same place. As I move the caret around the content of the definition bar changes. even inside the same line.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17242 Posts

Posted - Mar 08 2021 :  11:17:06 AM  Show Profile  Reply with Quote
Thank you for explaining, I see what this is doing now. Very simple, but so far all of my C# reading has been showing the use of constructors, not just setting the public methods.

First a stupid question, that really is VA's context and navigation bar in the screen shot, isn't it? I have the following sample code, and I am not even close to seeing what you are seeing:

namespace TestMakingClass
{
	class TestPartNumber
	{
		public static int FromInteger(int FromThis) { return FromThis * 2; }
	}
	class TestMakingPart
	{
        public string Name { get; set; }
		public string Description { get; set; }
		public int ProjectID { get; set; }
		public int PartNumber { get; set; }
		public string BarcodeFormat { get; set; }
		public string PartBarcode { get; set; }
	}
	class DoingTheActualMaking
	{
        public TestMakingPart CreatePart(int nOwnerID, int nPartID)
		{
            return new TestMakingPart
            {
                Name = $"Test{nPartID}",
                Description = $"Description for test part {nPartID}",
                ProjectID = nOwnerID,
                PartNumber = TestPartNumber.FromInteger(123456789 + nPartID),
                BarcodeFormat = "[PN]",
                PartBarcode = "[BC]"
            };
		}
	}
}

I have attached screen shots of what I am seeing.

I am getting exactly the same behaviour on two different machines, one my main system, and one with your settings and extensions installed. Can you please try the same code on your system? I cannot think of any VA setting that would explain the difference, so I am wondering if the effect is somehow file specific. My test case looks close enough to your code that it should show the same behaviour.






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

Uniwares
Tomato Guru

Portugal
2120 Posts

Posted - Mar 09 2021 :  04:50:42 AM  Show Profile  Reply with Quote
So, I just pasted you sample into my existing code where the other class resides.
Basically I am seeing what you see, but... there are differences:
1) when clicking on the members initialized in my code, the definition bar shows their definition. In your sample nothing is shown at all, for any of the members in the initialiser.
2) after restarting VS2019, the weird definition bar content in MY class is also gone.

So this seems to be a parsing bug that gets solved when reparsing the solution on load.
Anyway, check how the definition bar shows different content for the same CARET position depending on where you click with the MOUSE. Try clicking around the opening bracket after the "return new", small pixel differences makes different outcomes even if the caret ends up in the same location.
This is kinda strange, seems to me that VA takes its hint from the mouse click position first and second from the caret position. Meaning that you get different results when you navigate by keys or by mouse.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17242 Posts

Posted - Mar 09 2021 :  09:07:02 AM  Show Profile  Reply with Quote
Still no sign of any oddness here. I have tried clicking in different positions, and for me, the context field content is always a function of where the keyboard caret ends up, not the exact spot that I clicked with the mouse. It does suggest that something is confusing our parser in some of your code files. Are you seeing anything odd or out of place in VA Outline, the Alt-M list, VA's context and definition fields away from these initializations?

I am just looking for any obvious clues as to what is going on here.

Now I know what the code is doing, no context and definition field information inside the initialization block is a known bug:

case=24121

VA doesn't properly parse these blocks yet, but that still doesn't explain your strange context field behaviour.

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

Uniwares
Tomato Guru

Portugal
2120 Posts

Posted - Mar 09 2021 :  09:34:14 AM  Show Profile  Reply with Quote
All other VA windows seem fine.
Weird though that for my Part class I see correctly the definitions even when in the initialization block, but not for your class. So that case=24121 needs updating.

As for the varying definition on location, I will try to record a screen shot.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17242 Posts

Posted - Mar 09 2021 :  09:47:23 AM  Show Profile  Reply with Quote
In the Q7 solution I have on hand, the "Part.cs" file is only 31 lines long, and Find References doesn't find any other references for the Part class.

Is there any obvious difference between your Part class initialization and my test initialization? I am not sure why VA is handling it correctly for you in one place but not in another place.

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

Uniwares
Tomato Guru

Portugal
2120 Posts

Posted - Mar 09 2021 :  10:19:48 AM  Show Profile  Reply with Quote
Yeah, my version got a bit bigger since. Let me see if I can update yours...
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