Bug 14109 - Find All References doesn't find indirect references via generic types
Summary: Find All References doesn't find indirect references via generic types
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Linux
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-08-20 09:15 UTC by Marek Habersack
Modified: 2013-08-20 09:51 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Marek Habersack 2013-08-20 09:15:11 UTC
Given the code:

class Stuff
{
   public string Prop1 { get; set; }
}
 
class Base <T> where T: class
{
  T TypedInfo { get; set; }
 
  public Base ()
  {
    TypedInfo = new T ();
  }
}
 
class Derived : Base <Stuff>
{
  public Derived ()
  {
    Console.WriteLine (TypedInfo.Prop1);
  }
}

clicking on Prop1 in Stuff definition will not find the reference in the Derived's constructor.
Comment 1 Mike Krüger 2013-08-20 09:34:03 UTC
Prop1 isn't accessible at that point - TypedInfo needs to be accessible (public or protected would do it) - then it finds the reference to Prop1.
Comment 2 Marek Habersack 2013-08-20 09:43:28 UTC
Buildable and runnable code:

using System;

class Stuff
{
	public string Prop1 { get; set; }

	public Stuff ()
	{
		Prop1 = "Property 1";
	}
}
 
class Base <T> where T: class,new()
{
	public T TypedInfo { get; set; }
 
	public Base ()
	{
		TypedInfo = new T ();
	}
}
 
class Derived : Base <Stuff>
{
	public Derived ()
	{
		Console.WriteLine (TypedInfo.Prop1);
	}

	static void Main ()
	{
		var d = new Derived ();
	}
}

Removing Prop1 will break the build, ergo FindReferences is wrong.
Comment 3 Mike Krüger 2013-08-20 09:51:39 UTC
still works for me