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 2375: goto member oddities
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 09 2020 :  05:21:52 AM  Show Profile  Reply with Quote
In this screenshot are a few oddities:
1) the SatisfiedChangeHandler is listed twice (with different icons)
2) Equals is listed a few times with the same type albeit differently expressed
3) coloring of property @Tolerance is off
4) display of the properties, some with {...} others not
5) Event handler color is a known bug (just mentioning)



Also, in this example, clicking on the Name or Satisfied properties doesnt go anywhere, but thats only with the properties of the base class. All methods, events, delegates work fine.

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 09 2020 :  10:16:27 AM  Show Profile  Reply with Quote
Any change of getting a copy of this .cs file? The version I have of this class, from the last time you sent me your Q7 solution, only contains 3 members, and none of the interesting ones.

I am off to read up more on C# to try and work out what you are doing here

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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 09 2020 :  10:31:38 AM  Show Profile  Reply with Quote
Sorry for the fuss :) . Yes I can get you the file(s). Send it in later.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 09 2020 :  11:42:31 AM  Show Profile  Reply with Quote
Properties being shown with or without {...} first. Assuming you have the following C# code:

class TimePeriod
{
    private double _seconds; // time is stored in seconds

    // expression bodied property, no "{...}" in goto member
    public bool Morning => Hours < 12;

    // this time there is "{...}" in goto member
    public double Minutes
    {
        get => _seconds / 60;
        set => _seconds = value * 60; // should really error check
    }
}


at least in this case, what the Goto Member dialog is doing seems perfectly reasonable. One has a body using curly brackets and one doesn't, and this is reflected in what is shown.

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

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 09 2020 :  11:45:53 AM  Show Profile  Reply with Quote
For "Tolerance", the @ is marking this as a verbatim identifier, which lets you use a keyword as a variable name. But Tolerance isn't a keyword, so why do this? As for the colouring, you want the symbol "Tolerance" to be both a type and a variable at the same time, so it's not really surprising VA gets a bit confused here.

Different types of symbols with the same name sometimes getting the wrong colour is a known problem.

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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 09 2020 :  12:47:18 PM  Show Profile  Reply with Quote
Have a look at this shot:


Doesnt that look great? Tolerance colored as class and @Tolerance colored as property. Whoa, VA can do it. Just not everywhere. Sure, no need to really use the @ sign yet it helps a bit in visually distinguishing betwen class and property of the same name.

Now for the properties:
Tolerance is a full property, Name is an auto property and Satisfied is a full readonly property. Even converting Name to a full property, it continues to be shown as in the screen shot. Might be because its in the base class, but anyway, this should not make a difference. Kinda confusing.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 09 2020 :  1:35:14 PM  Show Profile  Reply with Quote
I have the files, thank you for these. I am testing by sitting in the file "ConstraintWithTolerance.cs", line 18, and triggering Alt-Shift-G on the line:

public class ConstraintWithTolerance : Constraint

and going to the Goto Member dialog.

Have you tried a VA symbol database rebuild yet?

I cannot reproduce problems 1 and 6. There is only one instance of the "SatisfiedChangeHandler" symbol for me, and Enter on both "Name" and "Satisfied" take me to the matching code.

There are several entries for different types of Equals, but since these are different overloads that are being inherited, this seems reasonable and normal. Also I am not spotting the wrong display for properties. Name and Satisfied properties are both shown with {...} at the end. In fact I am not seeing any properties here that lack this.

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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 09 2020 :  1:56:05 PM  Show Profile  Reply with Quote
Rebuilt database now, cleared cache, restarted VS. Same result. Actually, no, now its worse. I got both delegates twice now. And the Tolerance property twice.



And if you look at the Equals you'll see that there are duplicates, only 2 Equals() are in the base class implemented.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 11 2020 :  11:49:50 AM  Show Profile  Reply with Quote
I still cannot reproduce. I have taken the following steps, in order, to try and make sure I am doing a solid test.

On first loading your Q7 project, VS2019 creates a new SLN file on exit, since there is no SLN included in the zip file. No problem, but worth mentioning in case it could be a factor.
On a clean Windows 10 machine I used the "Extension Manager" extension to install all of the extensions you have, as of April 2020.
I have also imported your IDE and VA settings, again from April.

I then loaded the Q7 solution, and triggered a VA symbol database rebuild.

After another VS2019 restart, I am sitting in the file "ConstraintWithTolerance.cs", on line 18, and triggering Alt-Shift-G on the class name "ConstraintWithTolerance", which gets me to the Goto Member dialog, which lists 20 items. Both check boxes at the bottom of the dialog are ticked.

So I should be doing the same thing you are, with the same code and settings, so I should be seeing the same result, in theory.

Is there any obvious step I am missing, or something that I am doing differently to you?





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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 11 2020 :  11:59:05 AM  Show Profile  Reply with Quote
Sounds about right. Still we are seeing different results. Didn't change extensions either. So, not sure what may trigger the difference. We have a difference of 4 members in the same source. Very concerning fact.

Edited by - Uniwares on Jun 11 2020 12:01:15 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 12 2020 :  10:17:37 AM  Show Profile  Reply with Quote
Let's look at the differences between our results then, and see if this offers any clues. The top two entries in your members list, both list themselves as derived from:

System.MulticastDelegate

I have done an IDE find in files across the solution and am not seeing any references to "MulticastDelegate". Do you use this in this solution? Perhaps in a chunk I don't have? I am just looking for clues as to where this is coming from.

The extra Equals, with the template instance of System.IEquitable, does Enter on this entry do anything?

Can you right click in the Goto Member dialog and make sure that "Tooltips" is turned On. If you now hover the mouse over any of the first column entries, over the text, do you get a useful tooltip for any of the extra references you are getting?

For the Equals coming from System.IEquitable entries I have I am just getting "Equals" in the tooltip, but for the other Equals entries I am also getting the full file path and line number of the reference.

How many of the "problem" entries disappear if you turn Off "Show symbols from base classes"? I wonder if all of the problem references are somehow being inherited from a base class.

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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 12 2020 :  11:08:56 AM  Show Profile  Reply with Quote
MultiCastDelegate is a builtin type from the System libraries and implements "delegate".
When I turn off the base class members, only 3 items are left, one wrongly: the Tolerance property which appears twice.


Only the second and third Equals members go anywhere on enter. The others just close the dialog.
As expected, the wrong entries do not provide any useful tooltip, just the name that is already visible.
Oh, and when doing a Goto Member on the Constraint class itself, it shows pretty much the same problems.




Edited by - Uniwares on Jun 12 2020 11:13:29 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 13 2020 :  09:15:20 AM  Show Profile  Reply with Quote
All of these results are basically what we are expecting at this point, sad to say. New idea, can you please go to the file "Constraint.cs" and at the bottom of the namespace, add this new, slimmed down version of the Constraint class. I have just simplified it a bit, taken out the comments, and the base class. Since this will be in the same file and solution, even namespace, I am curious as to what VA will do and show here in the Goto Member dialog:

public class FelineConstraint
{
	private bool _evaluated = false;

	public Constraint() { }

	public delegate void SatisfiedChangeHandler(bool b);
	public delegate void ToleranceErrorHandler(object context);

	public event SatisfiedChangeHandler SatisfiedChanged;
	public event ToleranceErrorHandler ToleranceError;
	public virtual string Name { get; set; }

	public virtual bool Satisfied
	{
		[DebuggerStepThrough]
		get { return _evaluated; }
	}
	internal void RaiseSatisfiedChangedEvent(bool satisfied) { SatisfiedChanged?.Invoke(satisfied); }
	internal void RaiseToleranceErrorEvent(object context) { ToleranceError?.Invoke(context); }
	public virtual void EndEvaluation() { _evaluated = true; }
	public override bool Equals(object obj) { return false; }
	public bool Equals(Constraint other) { return false; }
	public override int GetHashCode() { return 1915637833; }
	public virtual void StartEvaluation() { _evaluated = false; }
}

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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 13 2020 :  12:05:27 PM  Show Profile  Reply with Quote
Comes up like this:

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 15 2020 :  07:46:42 AM  Show Profile  Reply with Quote
Exactly the same result as I get, and all correct. There isn't some subtle problem I am missing here is there?

If not, what happens if you make FelineConstraint a child class of "IEquatable<Constraint>" or "IEquatable<FelineConstraint>" ?

Testing here, when using:

public class FelineConstraint : IEquatable<Constraint>

and after doing a VA symbol database rebuild, I still get 17 items in the Goto Member dialog, with "Show symbols from base classes" turned On. I get the same result for:

public class FelineConstraint : IEquatable<FelineConstraint>

If you see the same results, but are still seeing the problem with the Constraint problem, then I am starting to wonder if somehow, the problem is triggered by one of the places in your code where you use the class Constraint, rather than where it is declared. That, or we are having a problem with the IEquatable base class...

To check that thought, I have just triggered Goto Member on "IEquatable", and am getting a single entry listed, "Equals". The same result on both my Feline class line and your Constraint class line.

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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 15 2020 :  09:30:17 AM  Show Profile  Reply with Quote
After adding the IEquatable<> interface:


Definitely gets confused by the IEquatable<> interface, but I think problems start when you derive from a class which implements interfaces, although I cant exactly repro with the FelineConstraint class yet. I tried deriving various other classes as its done with the Constraint class, but to no avail. The Constraint class remains weird and FelineConstraint doesnt.
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 15 2020 :  09:39:18 AM  Show Profile  Reply with Quote
Now I tried something even simpler: just copied the original Constraint class, and just renamed it to AConstraint, copied some derived classed and also renamed them to A* without changing anything else. All looks fine (except the IEquatables).
So, what I think here is that those weirdos are a result of implementing the class(es). Changes throughout the lifetime that didnt get updated correctly, although, this should be resolved by rebuilding the database.

Yet: bear with me...
What got me confused here is the MultiCastDelegate. This is something that is known only after actually compiling the code, maybe even only at runtime, no sure.
Why? Because the runtime determines if its a System.Delegate or system.MultiCastDelegate from the use of the delegate. So, simply writing the code in the base class wouldnt allow this.
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 15 2020 :  09:45:35 AM  Show Profile  Reply with Quote
Does that mean anything to you? Because this appears a lot in the VA Startup log.


InitInst::157 6/3/2020 12:07:22 0x8964
Exception: VAP::3286 6/4/2020 18:33:38 0xdc18
InitInst::157 6/5/2020 09:15:21 0x1b48
GetSymDefStrs idx c:\users\saurw\appdata\local\microsoft\visualstudio\16.0_4224de93\extensions\qr11vfuq.o4e\Data\vs16_1\net\Db43Ds.db is corrupt, fid=0x11bd9d4b, sp=0x1, rel=0x26515, act=0x1a8246 tid=5596 uiTid=6984:322 6/5/2020 15:11:41 0x15dc
GetSymDefStrs idx c:\users\saurw\appdata\local\microsoft\visualstudio\16.0_4224de93\extensions\qr11vfuq.o4e\Data\vs16_1\net\Db43Ds.db is corrupt, fid=0x11bd9d4b, sp=0x1, rel=0x2649c, act=0x1a81cd tid=5596 uiTid=6984:322 6/5/2020 15:11:41 0x15dc
InitInst::157 6/5/2020 19:59:01 0x2558
InitInst::157 6/8/2020 09:49:14 0x202c
InitInst::157 6/8/2020 11:45:21 0x4e10
InitInst::157 6/8/2020 16:53:43 0x6480
InitInst::157 6/8/2020 17:31:39 0x2e4c
InitInst::157 6/9/2020 15:56:28 0x267c
GetSymDefStrs idx c:\users\saurw\appdata\local\microsoft\visualstudio\16.0_4224de93\extensions\qr11vfuq.o4e\Data\vs16_1\net\Db43Ds.db is corrupt, fid=0x11bd9d4b, sp=0x1, rel=0x8257, act=0x189f88 tid=3148 uiTid=9852:322 6/9/2020 16:37:25 0xc4c
GetSymDefStrs idx c:\users\saurw\appdata\local\microsoft\visualstudio\16.0_4224de93\extensions\qr11vfuq.o4e\Data\vs16_1\net\Db43Ds.db is corrupt, fid=0x11bd9d4b, sp=0x1, rel=0x28e1b, act=0x1aab4c tid=3148 uiTid=9852:322 6/9/2020 17:38:38 0xc4c
GetSymDefStrs idx c:\users\saurw\appdata\local\microsoft\visualstudio\16.0_4224de93\extensions\qr11vfuq.o4e\Data\vs16_1\net\Db43Ds.db is corrupt, fid=0x11bd9d4b, sp=0x1, rel=0x2aa9a, act=0x1ac7cb tid=3148 uiTid=9852:322 6/9/2020 17:38:38 0xc4c
GetSymDefStrs idx c:\users\saurw\appdata\local\microsoft\visualstudio\16.0_4224de93\extensions\qr11vfuq.o4e\Data\vs16_1\net\Db43Ds.db is corrupt, fid=0x11bd9d4b, sp=0x1, rel=0x139be, act=0x1956ef tid=3148 uiTid=9852:322 6/9/2020 18:02:07 0xc4c
InitInst::157 6/9/2020 18:46:41 0x57fc
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 15 2020 :  10:32:35 AM  Show Profile  Reply with Quote
So, after a lot of trying out I know how to fix it, but not what caused it.
1) rebuilt database -> no result
2) deleted the whole data folder of VA (c:\users\saurw\appdata\local\microsoft\visualstudio\16.0_4224de93\extensions\qr11vfuq.o4e\Data\) -> no result
3) deleted the bin and obj folders of the solution -> back to normal now

It seems that the errors are coming from mixing parsed information with the compiled information from VS, which would explain the MultiCastDelegates too.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 16 2020 :  08:49:22 AM  Show Profile  Reply with Quote
In my reading about C# I have come across the concept of "reflection" various times, but I have not read up enough on C# to really know much about this. I do know that sometimes when jumping to symbols the source code is generated, and you are taken to a file in the system TEMP directory.

But I don't understand why VA would want / need to look up symbols from your compiled code, since we have the full source code in hand to start with.

If, or more likely when, this starts happening again, would it be possible to get a copy of the full project, including the bin and obj folders, so I can try to reproduce and study this here? I realise this might not be possible, but it's worth asking on the off chance.

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

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 16 2020 :  09:31:12 AM  Show Profile  Reply with Quote
My guess is that its the IDE that provides some information from IL code. And somehow it doesnt match up with what VA knows about the source. (like the delegate keyword ending up being either System.Delegate or System.MultiCastDelegate, how VA would connect that back to the source code without compiling it?)

Of course, next time I send the whole package to you.
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 16 2020 :  1:07:31 PM  Show Profile  Reply with Quote
So, i just have a very similar case with a new class I wrote. I will FTP the project complete with the VA data folder.
The class in question is WorkStationConfigurationSection and it shows up quite a lot of things that I wouldnt expect, among it references to duplicate ctors, etc.

Edited by - Uniwares on Jun 17 2020 04:25:27 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Jun 23 2020 :  11:26:20 AM  Show Profile  Reply with Quote
Partial progress, thanks to the project files. For the class�MarshalByRefObject the extra member "CreateObjRef" is only listed in the Goto Member dialog when the Sharp7 project is actually loaded.� It actually has nothing to do with any of the code in the Sharp7 project, since I have been able to remove all of this and I still get the problem.

So it seems that somehow one of the two Dependencies:

.NETFramework 4.0

.NETStandard 2.0

is somehow responsible for this extra member being listed.� I have put in a bug report for this:

case=142399

Unfortunately I have not been able to reproduce any of the problems you have where compile time information is being used to add members to the VA Goto Member dialog, so I still don't know what is going on there.

zen is the art of being at one with the two'ness

Edited by - feline on Jun 23 2020 11:26:35 AM
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2318 Posts

Posted - Jun 23 2020 :  11:35:00 AM  Show Profile  Reply with Quote
At least some progress. Maybe that found will lead the devs to something more.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000