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 2451: definition resolves to wrong class
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2229 Posts

Posted - Jul 29 2022 :  07:06:58 AM  Show Profile  Reply with Quote
A bit of a complex situation but here it goes:
C#, VS2017

I have a solution with one project that has about 20 web references (REST) of which half implement a class called "Document" in their respective namespace (all in Reference.cs in their own folder as created when adding a webreference).
In another project those web services are consumed. When I reference a certain webservice by "using" its namespace, obviously the Document class in this given namespace is available.
Now, when I use the Document class somewhere and put the caret on it, in the definition bar always appears the Document class in the alphabetically first namespace and not the one referenced in the current file.

When I fully specify the document class with its namespace all it good.
This of course also affects the Goto feature (Ctrl+Click by default), which goes to the wrong definition.

Let me try to visualize this:
Project 1:
	WebService1
		Reference.cs
			public class Document
	WebService2
		Reference.cs
			public class Document
        WebService3
		Reference.cs
			public class Document
	WebService4
		Reference.cs
			public class Document
			
Project 2:
	SomeFile.cs
		using WebService3;
		var x = new Document(); // this should resolve to WebService3.Document








feline
Whole Tomato Software

United Kingdom
17863 Posts

Posted - Jul 29 2022 :  10:54:13 AM  Show Profile  Reply with Quote
We should handle this correctly, but I am not really surprised at this bug, given the problems I have seen with duplicate names over the years.

Is the "Document" class name a function of it being a web reference / REST project, or just a logical name? I am setting up a test now, but if web reference projects are going to encourage this problem to happen that's worth knowing.

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

Uniwares
Tomato Guru

Portugal
2229 Posts

Posted - Jul 29 2022 :  10:58:50 AM  Show Profile  Reply with Quote
Just a class name, no methods of the same name in this case. I think it might happen with other classes structured the same way but not sure. Didnt have time to test.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17863 Posts

Posted - Jul 29 2022 :  11:54:08 AM  Show Profile  Reply with Quote
I have set up a very simple test case, perhaps far to simple, but so far no sign of the problem. I have emailed you my simple test case, so you can see what I have tried:

case=148403

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

Uniwares
Tomato Guru

Portugal
2229 Posts

Posted - Jul 29 2022 :  12:13:11 PM  Show Profile  Reply with Quote
Yeah, there seems to be more to it than is happening in this sample project. Cant repro it neither with it. Next week I am on vacation, will try to make a full test project.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17863 Posts

Posted - Aug 01 2022 :  04:38:22 AM  Show Profile  Reply with Quote
Obviously if you have something you are able to share, purely for testing purposes, I am happy to try and find the trigger. Sometimes the trigger for odd bugs can be quite unexpected, as I am sure you know.

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:
© 2021 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000