History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-42957
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Eugene Pasynkov
Reporter: Nazar Revutsky
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ReSharper

Incorrect Find Usages for interfaces

Created: 12 Jun 07 13:30   Updated: 18 Jun 07 12:24
Component/s: Code View - Search
Fix Version/s: Future Versions
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 456
Fixed in build: 500


 Description  « Hide
public interface IMyControl
{
...
string ID \{ get; \}
...
}

1
Find Usages Advanced (for IMyControl.ID) -> Implementing Properties
give me results:
...
System.Web.UI.Control ID:string
...

but System.Web.UI.Control does not implement IMyControl

2
Find Usages (for IMyControl.ID)
give me results:
All usages ID property (even class does not implement IMyControl)



 All   Comments   Work Log   Change History      Sort Order:
Ilya Ryzhenkov - 12 Jun 07 16:13
It looks like it found quasi-implementations, like this:
public interface IMyControl
{
 string ID { get; }
}

public class MyControl : System.Web.UI.Control, IMyControl
{
}

public MyClass
{
  System.Web.UI.Control myControl = new MyControl();
 // using myControl.ID implies using IMyControl.ID
}

At this point, whenever you use Control.ID it may happen you are using IMyControl.ID.
It is called quasi-implementation, i.e. Control quasi-implements IMyControl for the ID property.

Is this the case?


Nazar Revutsky - 12 Jun 07 19:52
In this case we have only one usage of IMyControl.ID
public interface IMyControl
	{
		string ID { get; }
	}

	public sealed class MyControl2 : IMyControl
	{
		public string ID { get { return GetType().FullName; } }
	}

	public sealed class MyControl3 : System.Web.UI.Control
	{
	}


	public class MyClass
	{
		MyControl2 myControl2 = new MyControl2();
		MyControl3 myControl3 = new MyControl3();

		public MyClass()
		{
			string id;
			id = myControl2.ID;	// Only one usage
			id = myControl3.ID;
		}
	}

In this case R# find 3 usages

public interface IMyControl
		{
			string ID { get; }
		}

		public class MyControl1 : System.Web.UI.Control, IMyControl
		{
		}

		public sealed class MyControl2 : IMyControl
		{
			public string ID { get { return GetType().FullName; } }
		}

		public sealed class MyControl3 : System.Web.UI.Control
		{
		}


		public class MyClass
		{
			System.Web.UI.Control myControl1 = new MyControl1();
			MyControl2 myControl2 = new MyControl2();
			MyControl3 myControl3 = new MyControl3();

			public MyClass()
			{
				string id;
				id = myControl1.ID;
				id = myControl2.ID;
				id = myControl3.ID;
			}
		}

but myControl3.ID - is not of implementation IMyControl (myControl3 is MyControl3 type and MyControl3 is sealed and has no base types which implement IMyControl.