Bug 11223 - Tooltip over extension methods is wrong
Summary: Tooltip over extension methods is wrong
Status: RESOLVED FEATURE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-03-18 05:16 UTC by Marek Safar
Modified: 2013-03-18 06:44 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 FEATURE

Description Marek Safar 2013-03-18 05:16:04 UTC
using System;

static class BugReport
{
	static float MyProperty { set { } }
	
	static void MyExtension(this float val)
	{
	}
	
	public static void Main(string[] args)
	{
		MyProperty.MyExtension(); // Hover over MyExtension, there is no such method described in tooltip
	}
}
Comment 1 Mike Krüger 2013-03-18 05:46:47 UTC
For the user it is - that this is an extension method is in the tooltip as well.
Comment 2 Marek Safar 2013-03-18 05:54:10 UTC
Firstly, I thought extension method can be static only.
Secondly, when I have more than 1 with same parameters count MD does not give me any clue which one it's used.

Cannot believe we'd have such poor feature.
Comment 3 Mike Krüger 2013-03-18 06:16:00 UTC
It's not a poor feature, it's a design decision. The problem more than 1 with same parameters count is >now true< because parameters ARE shown ... I don't know what your use case is.

Extension methods mimic member methods - that's shown. esp. with parameter completion this makes more sense than showing the 'this' parameter. We never have shown the this parameter there ...

How would you represent the extension methods ?
Comment 4 Marek Safar 2013-03-18 06:29:17 UTC
Simple use case like this one http://screencast.com/t/Ayt9rkurh
Comment 5 Mike Krüger 2013-03-18 06:34:16 UTC
... that's no use case that I would say it's valid.

it's like:

class A { public void Foo (); }
class B { public void Foo (); }

o.Foo ();
Comment 6 Marek Safar 2013-03-18 06:37:56 UTC
Then it's maybe time to check some real extension code like in mscorlib https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Reflection/CustomAttributeExtensions.cs
Comment 7 Mike Krüger 2013-03-18 06:44:46 UTC
it's like my example - many classes have the same method.

You're arguing about that the user doesn't know on which type it's executed. Just hover over the object that'll tell you the type. If you still don't know which method is taken use a jump to declaration.

Our way of showing this is in line with member methods & it's easy to use for the parameter completion. It's much more compact than showing the 'this' parameter all the time. It's more what the average user wants.

btw. you can always use static usage of extension methods ... then you'll see the 1st parameter as well.