Skip to content

Odd IntelliSense Behavior with Overloaded Methods #36187

@vsfeedback

Description

@vsfeedback

VSF_TYPE_MARKDOWNWhen you type the following code:

private enum A
{
	A,
	B,
}

private void Get(A a) { }
private void Get(string a) { }

private void Test()
{
	Get(
}

When you type the ( after the Get in the Test method, VS suggests to autocomplete the first parameter of type A, which is exactly expected.

See this picture: https://cdn.discordapp.com/attachments/369794346142269441/577795445443657728/unknown.png

But when you change the declaration order of the two Get methods, like this:

private enum A
{
	A,
	B,
}

private void Get(string a) { }
private void Get(A a) { }

private void Test()
{
	Get(
}

And now if you type (, you get no suggestions. Notice that the first overloaded method that shows up is still the one with the A parameter, and not the string one.

See this picture: https://cdn.discordapp.com/attachments/369794346142269441/577795671596335124/unknown.png

Pressin the default Ctrl+Space does not help either.

Expected behavior: When the Get(A a) method is selected as the current overload, pressing Ctrl+Space should suggest to complete that given parameter.

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/567651/odd-intellisense-behavior-with-overloaded-methods.html
VSTS ticketId: 892502

These are the original issue comments:

Visual Studio Feedback System on 5/14/2019, 09:42 PM (21 days ago):

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Vatsalya Agrawal [MSFT] on 5/15/2019, 00:11 PM (21 days ago):

Thank you for providing feedback, and we're sorry to hear it's not behaving as you expect. Based on your description so far, we were unable to reproduce the issue. Pressing Ctrl + Space seems to be suggesting the right parameter. If possible please provide a sample project where this issue is occurring.

matej.zajacik on 5/15/2019, 00:33 PM (21 days ago): (private comment)

Thank you for the reply!

When the declaration order is Get(A a) and then Get(string a), everything works okay. Right after typing (, it does the expected thing, that is suggesting the enum A (the first picture). But when the order is Get(string a) and then Get(A a), I get no suggestion at all (the second picture). When I press Ctrl+Space, it suggests to use the ToString() method:

intellisenseissue00.png

The project: intellisenseissue.zip

These are the original issue solutions:
(no solutions)

Metadata

Metadata

Assignees

Labels

Area-IDEBugDeveloper CommunityThe issue was originally reported on https://developercommunity.visualstudio.comIDE-IntelliSenseCompletion, Signature Help, Quick Info

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions